Skip to content

Commit a203213

Browse files
committed
Statify updated linter rules
1 parent aa39aa8 commit a203213

13 files changed

+87
-86
lines changed

.github/workflows/ci.yaml

+48-48
Original file line numberDiff line numberDiff line change
@@ -30,51 +30,51 @@ jobs:
3030
with:
3131
version: v1.57.2
3232

33-
# build:
34-
# name: build
35-
# runs-on: ubuntu-latest
36-
# strategy:
37-
# matrix:
38-
# go: [1.21]
39-
# store-type:
40-
# -
41-
# - memory
42-
# - file
43-
# - mongo
44-
# fix-version:
45-
# -
46-
# - fix40
47-
# - fix41
48-
# - fix42
49-
# - fix43
50-
# - fix44
51-
# - fix50
52-
# - fix50sp1
53-
# - fix50sp2
54-
# steps:
55-
# - name: Setup
56-
# uses: actions/setup-go@v2
57-
# with:
58-
# go-version: ${{ matrix.go }}
59-
# - name: Check out source
60-
# uses: actions/checkout@v2
61-
# - name: Start MongoDB
62-
# uses: supercharge/[email protected]
63-
# with:
64-
# mongodb-replica-set: replicaset
65-
# - name: Install ruby
66-
# uses: ruby/setup-ruby@v1
67-
# with:
68-
# ruby-version: '3.0'
69-
# - name: Unit test
70-
# env:
71-
# FIX_TEST: ${{ matrix.fix-version }}
72-
# STORE_TYPE: ${{ matrix.store-type }}
73-
# run: if [ -z $FIX_TEST ] && [ -z $STORE_TYPE ]; then make build-src && make test-ci; fi
74-
# - name: Acceptance test
75-
# env:
76-
# GO111MODULE: on
77-
# MONGODB_TEST_CXN: mongodb://localhost:27017
78-
# FIX_TEST: ${{ matrix.fix-version }}
79-
# STORE_TYPE: ${{ matrix.store-type }}
80-
# run: if [ $FIX_TEST ] && [ $STORE_TYPE ]; then make generate-ci && make build && make $FIX_TEST; fi
33+
build:
34+
name: build
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
go: [1.21]
39+
store-type:
40+
-
41+
- memory
42+
- file
43+
- mongo
44+
fix-version:
45+
-
46+
- fix40
47+
- fix41
48+
- fix42
49+
- fix43
50+
- fix44
51+
- fix50
52+
- fix50sp1
53+
- fix50sp2
54+
steps:
55+
- name: Setup
56+
uses: actions/setup-go@v2
57+
with:
58+
go-version: ${{ matrix.go }}
59+
- name: Check out source
60+
uses: actions/checkout@v2
61+
- name: Start MongoDB
62+
uses: supercharge/[email protected]
63+
with:
64+
mongodb-replica-set: replicaset
65+
- name: Install ruby
66+
uses: ruby/setup-ruby@v1
67+
with:
68+
ruby-version: '3.0'
69+
- name: Unit test
70+
env:
71+
FIX_TEST: ${{ matrix.fix-version }}
72+
STORE_TYPE: ${{ matrix.store-type }}
73+
run: if [ -z $FIX_TEST ] && [ -z $STORE_TYPE ]; then make build-src && make test-ci; fi
74+
- name: Acceptance test
75+
env:
76+
GO111MODULE: on
77+
MONGODB_TEST_CXN: mongodb://localhost:27017
78+
FIX_TEST: ${{ matrix.fix-version }}
79+
STORE_TYPE: ${{ matrix.store-type }}
80+
run: if [ $FIX_TEST ] && [ $STORE_TYPE ]; then make generate-ci && make build && make $FIX_TEST; fi

.golangci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
run:
22
timeout: 10m
3+
# deprecated config -
34
# skip-dirs:
45
# - gen
56
# - vendor

Makefile

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+14-14
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

+5-5
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

+7-7
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
}

session_factory_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ func (s *SessionFactorySuite) TestInvalidWeekdays() {
373373
}
374374

375375
for _, testcase := range testcases {
376-
s.T().Run(testcase.label, func(t *testing.T) {
376+
s.T().Run(testcase.label, func(_ *testing.T) {
377377
s.SessionSettings.Set(config.Weekdays, testcase.input)
378378

379379
_, err := s.newSession(s.SessionID, s.MessageStoreFactory, s.SessionSettings, s.LogFactory, s.App)

store/sql/sqlstore.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ func sqlString(raw string, placeholder placeholderFunc) string {
5050
return raw
5151
}
5252
idx := 0
53-
return rePlaceholder.ReplaceAllStringFunc(raw, func(s string) string {
54-
new := placeholder(idx)
53+
return rePlaceholder.ReplaceAllStringFunc(raw, func(_ string) string {
54+
p := placeholder(idx)
5555
idx++
56-
return new
56+
return p
5757
})
5858
}
5959

validation.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func validateFIXT(transportDD, appDD *datadictionary.DataDictionary, settings Va
149149
return nil
150150
}
151151

152-
func validateMsgType(d *datadictionary.DataDictionary, msgType string, msg *Message) MessageRejectError {
152+
func validateMsgType(d *datadictionary.DataDictionary, msgType string, _ *Message) MessageRejectError {
153153
if _, validMsgType := d.Messages[msgType]; !validMsgType {
154154
return InvalidMessageType()
155155
}
@@ -296,7 +296,7 @@ func validateRequired(transportDD *datadictionary.DataDictionary, appDD *datadic
296296
return nil
297297
}
298298

299-
func validateRequiredFieldMap(msg *Message, requiredTags map[int]struct{}, fieldMap FieldMap) MessageRejectError {
299+
func validateRequiredFieldMap(_ *Message, requiredTags map[int]struct{}, fieldMap FieldMap) MessageRejectError {
300300
for required := range requiredTags {
301301
requiredTag := Tag(required)
302302
if !fieldMap.Has(requiredTag) {
@@ -328,7 +328,7 @@ func validateFields(transportDD *datadictionary.DataDictionary, appDD *datadicti
328328
return nil
329329
}
330330

331-
func validateField(d *datadictionary.DataDictionary, validFields datadictionary.TagSet, field TagValue) MessageRejectError {
331+
func validateField(d *datadictionary.DataDictionary, _ datadictionary.TagSet, field TagValue) MessageRejectError {
332332
if len(field.value) == 0 {
333333
return TagSpecifiedWithoutAValue(field.tag)
334334
}

0 commit comments

Comments
 (0)