Skip to content

Commit 9886e68

Browse files
authored
Merge pull request #626 from ackleymi/main
Update and satisfy code linter
2 parents 04786a1 + a203213 commit 9886e68

File tree

13 files changed

+49
-44
lines changed

13 files changed

+49
-44
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ jobs:
2121
name: Linter
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v3
25-
- uses: actions/setup-go@v4
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-go@v5
2626
with:
2727
go-version: '1.21'
28-
cache: false
2928
- name: golangci-lint
30-
uses: golangci/golangci-lint-action@v3
29+
uses: golangci/golangci-lint-action@v4
3130
with:
32-
version: v1.51
31+
version: v1.57.2
3332

3433
build:
3534
name: build

.golangci.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
run:
22
timeout: 10m
3-
skip-dirs:
3+
# deprecated config -
4+
# skip-dirs:
5+
# - gen
6+
# - vendor
7+
8+
issues:
9+
exclude-dirs:
410
- gen
511
- vendor
612

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test:
1919
linters-install:
2020
@golangci-lint --version >/dev/null 2>&1 || { \
2121
echo "installing linting tools..."; \
22-
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.50.1; \
22+
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.57.2; \
2323
}
2424

2525
lint: linters-install

datadictionary/datadictionary.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ func Parse(path string) (*DataDictionary, error) {
315315
func ParseSrc(xmlSrc io.Reader) (*DataDictionary, error) {
316316
doc := new(XMLDoc)
317317
decoder := xml.NewDecoder(xmlSrc)
318-
decoder.CharsetReader = func(encoding string, input io.Reader) (io.Reader, error) {
318+
decoder.CharsetReader = func(_ string, input io.Reader) (io.Reader, error) {
319319
return input, nil
320320
}
321321

logon_state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (s logonState) Timeout(session *session, e internal.Event) (nextState sessi
6868
return s
6969
}
7070

71-
func (s logonState) Stop(session *session) (nextState sessionState) {
71+
func (s logonState) Stop(_ *session) (nextState sessionState) {
7272
return latentState{}
7373
}
7474

logout_state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ func (state logoutState) Timeout(session *session, event internal.Event) (nextSt
4040
return state
4141
}
4242

43-
func (state logoutState) Stop(session *session) (nextstate sessionState) {
43+
func (state logoutState) Stop(_ *session) (nextstate sessionState) {
4444
return state
4545
}

memorystore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func (store *memoryStore) GetMessages(beginSeqNum, endSeqNum int) ([][]byte, err
109109

110110
type memoryStoreFactory struct{}
111111

112-
func (f memoryStoreFactory) Create(sessionID SessionID) (MessageStore, error) {
112+
func (f memoryStoreFactory) Create(_ SessionID) (MessageStore, error) {
113113
m := new(memoryStore)
114114
if err := m.Reset(); err != nil {
115115
return m, errors.Wrap(err, "reset")

message.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func ParseMessageWithDataDictionary(
152152
msg *Message,
153153
rawMessage *bytes.Buffer,
154154
transportDataDictionary *datadictionary.DataDictionary,
155-
applicationDataDictionary *datadictionary.DataDictionary,
155+
_ *datadictionary.DataDictionary,
156156
) (err error) {
157157
msg.Header.Clear()
158158
msg.Body.Clear()
@@ -322,7 +322,7 @@ func (m *Message) IsMsgTypeOf(msgType string) bool {
322322
func (m *Message) reverseRoute() *Message {
323323
reverseMsg := NewMessage()
324324

325-
copy := func(src Tag, dest Tag) {
325+
copyFunc := func(src Tag, dest Tag) {
326326
var field FIXString
327327
if m.Header.GetField(src, &field) == nil {
328328
if len(field) != 0 {
@@ -331,25 +331,25 @@ func (m *Message) reverseRoute() *Message {
331331
}
332332
}
333333

334-
copy(tagSenderCompID, tagTargetCompID)
335-
copy(tagSenderSubID, tagTargetSubID)
336-
copy(tagSenderLocationID, tagTargetLocationID)
334+
copyFunc(tagSenderCompID, tagTargetCompID)
335+
copyFunc(tagSenderSubID, tagTargetSubID)
336+
copyFunc(tagSenderLocationID, tagTargetLocationID)
337337

338-
copy(tagTargetCompID, tagSenderCompID)
339-
copy(tagTargetSubID, tagSenderSubID)
340-
copy(tagTargetLocationID, tagSenderLocationID)
338+
copyFunc(tagTargetCompID, tagSenderCompID)
339+
copyFunc(tagTargetSubID, tagSenderSubID)
340+
copyFunc(tagTargetLocationID, tagSenderLocationID)
341341

342-
copy(tagOnBehalfOfCompID, tagDeliverToCompID)
343-
copy(tagOnBehalfOfSubID, tagDeliverToSubID)
344-
copy(tagDeliverToCompID, tagOnBehalfOfCompID)
345-
copy(tagDeliverToSubID, tagOnBehalfOfSubID)
342+
copyFunc(tagOnBehalfOfCompID, tagDeliverToCompID)
343+
copyFunc(tagOnBehalfOfSubID, tagDeliverToSubID)
344+
copyFunc(tagDeliverToCompID, tagOnBehalfOfCompID)
345+
copyFunc(tagDeliverToSubID, tagOnBehalfOfSubID)
346346

347347
// Tags added in 4.1.
348348
var beginString FIXString
349349
if m.Header.GetField(tagBeginString, &beginString) == nil {
350350
if string(beginString) != BeginStringFIX40 {
351-
copy(tagOnBehalfOfLocationID, tagDeliverToLocationID)
352-
copy(tagDeliverToLocationID, tagOnBehalfOfLocationID)
351+
copyFunc(tagOnBehalfOfLocationID, tagDeliverToLocationID)
352+
copyFunc(tagDeliverToLocationID, tagOnBehalfOfLocationID)
353353
}
354354
}
355355

null_log.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ package quickfix
1717

1818
type nullLog struct{}
1919

20-
func (l nullLog) OnIncoming([]byte) {}
21-
func (l nullLog) OnOutgoing([]byte) {}
22-
func (l nullLog) OnEvent(string) {}
23-
func (l nullLog) OnEventf(format string, a ...interface{}) {}
20+
func (l nullLog) OnIncoming([]byte) {}
21+
func (l nullLog) OnOutgoing([]byte) {}
22+
func (l nullLog) OnEvent(string) {}
23+
func (l nullLog) OnEventf(_ string, _ ...interface{}) {}
2424

2525
type nullLogFactory struct{}
2626

2727
func (nullLogFactory) Create() (Log, error) {
2828
return nullLog{}, nil
2929
}
30-
func (nullLogFactory) CreateSessionLog(sessionID SessionID) (Log, error) {
30+
func (nullLogFactory) CreateSessionLog(_ SessionID) (Log, error) {
3131
return nullLog{}, nil
3232
}
3333

quickfix_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,26 +85,26 @@ type MockApp struct {
8585
lastToApp *Message
8686
}
8787

88-
func (e *MockApp) OnCreate(sessionID SessionID) {
88+
func (e *MockApp) OnCreate(_ SessionID) {
8989
}
9090

91-
func (e *MockApp) OnLogon(sessionID SessionID) {
91+
func (e *MockApp) OnLogon(_ SessionID) {
9292
e.Called()
9393
}
9494

95-
func (e *MockApp) OnLogout(sessionID SessionID) {
95+
func (e *MockApp) OnLogout(_ SessionID) {
9696
e.Called()
9797
}
9898

99-
func (e *MockApp) FromAdmin(msg *Message, sessionID SessionID) (reject MessageRejectError) {
99+
func (e *MockApp) FromAdmin(_ *Message, _ SessionID) (reject MessageRejectError) {
100100
if err, ok := e.Called().Get(0).(MessageRejectError); ok {
101101
return err
102102
}
103103

104104
return nil
105105
}
106106

107-
func (e *MockApp) ToAdmin(msg *Message, sessionID SessionID) {
107+
func (e *MockApp) ToAdmin(msg *Message, _ SessionID) {
108108
e.Called()
109109

110110
if e.decorateToAdmin != nil {
@@ -114,12 +114,12 @@ func (e *MockApp) ToAdmin(msg *Message, sessionID SessionID) {
114114
e.lastToAdmin = msg
115115
}
116116

117-
func (e *MockApp) ToApp(msg *Message, sessionID SessionID) (err error) {
117+
func (e *MockApp) ToApp(msg *Message, _ SessionID) (err error) {
118118
e.lastToApp = msg
119119
return e.Called().Error(0)
120120
}
121121

122-
func (e *MockApp) FromApp(msg *Message, sessionID SessionID) (reject MessageRejectError) {
122+
func (e *MockApp) FromApp(_ *Message, _ SessionID) (reject MessageRejectError) {
123123
if err, ok := e.Called().Get(0).(MessageRejectError); ok {
124124
return err
125125
}

0 commit comments

Comments
 (0)