Skip to content

Commit 6bef431

Browse files
committed
ci: bump golangci-lint to v2
Only the linters that were previously included were enabled. The disabled linters will be enabled later, one by one.
1 parent aad7682 commit 6bef431

43 files changed

Lines changed: 602 additions & 514 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/check.yaml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,9 @@ jobs:
4343
- uses: actions/checkout@v5
4444

4545
- name: golangci-lint
46-
uses: golangci/golangci-lint-action@v3
47-
continue-on-error: true
46+
uses: golangci/golangci-lint-action@v9
4847
with:
49-
# The first run is for GitHub Actions error format.
50-
args: --config=.golangci.yaml
51-
52-
- name: golangci-lint
53-
uses: golangci/golangci-lint-action@v3
54-
with:
55-
# The second run is for human-readable error format with a file name
56-
# and a line number.
57-
args: --out-${NO_FUTURE}format colored-line-number --config=.golangci.yaml
48+
args: --config=.golangci.yml
5849

5950
codespell:
6051
runs-on: ubuntu-24.04

.golangci.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.golangci.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
version: "2"
2+
3+
formatters:
4+
enable:
5+
- goimports
6+
7+
linters:
8+
default: all
9+
settings:
10+
lll:
11+
line-length: 100
12+
exclusions:
13+
rules:
14+
- linters:
15+
- lll
16+
source: "^//go:generate "
17+
- linters:
18+
- lll
19+
source: "https?://"
20+
disable:
21+
- containedctx
22+
- contextcheck
23+
- copyloopvar
24+
- cyclop
25+
- depguard
26+
- dupl
27+
- dupword
28+
- embeddedstructfieldcheck
29+
- err113
30+
- errname
31+
- errorlint
32+
- exhaustive
33+
- exhaustruct
34+
- fatcontext
35+
- forcetypeassert
36+
- funcorder
37+
- funlen
38+
- gochecknoglobals
39+
- gochecknoinits
40+
- gocognit
41+
- goconst
42+
- gocyclo
43+
- godoclint
44+
- godox
45+
- gosec
46+
- gosmopolitan
47+
- iface
48+
- inamedparam
49+
- interfacebloat
50+
- intrange
51+
- ireturn
52+
- maintidx
53+
- makezero
54+
- mirror
55+
- misspell
56+
- mnd
57+
- modernize
58+
- nakedret
59+
- nestif
60+
- nilerr
61+
- nilnil
62+
- nlreturn
63+
- noctx
64+
- noinlineerr
65+
- nolintlint
66+
- nonamedreturns
67+
- paralleltest
68+
- perfsprint
69+
- prealloc
70+
- predeclared
71+
- recvcheck
72+
- revive
73+
- staticcheck
74+
- tparallel
75+
- testableexamples
76+
- testifylint
77+
- testpackage
78+
- thelper
79+
- unparam
80+
- unqueryvet
81+
- varnamelen
82+
- wastedassign
83+
- whitespace
84+
- wrapcheck
85+
- wsl
86+
- wsl_v5

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ format:
3636

3737
.PHONY: golangci-lint
3838
golangci-lint:
39-
golangci-lint run --config=.golangci.yaml
39+
golangci-lint run --max-same-issues 0 --max-issues-per-linter 100
4040

4141
.PHONY: test
4242
test:

arrow/tarantool_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestInsert_invalid(t *testing.T) {
6060
}
6161

6262
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
63-
defer conn.Close()
63+
defer func() { _ = conn.Close() }()
6464

6565
for i, a := range arrows {
6666
t.Run(strconv.Itoa(i), func(t *testing.T) {

auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const (
2121
AutoAuth Auth = iota
2222
// ChapSha1Auth forces chap-sha1 authentication method. The method is
2323
// available both in the Tarantool Community Edition (CE) and the
24-
// Tarantool Enterprise Edition (EE)
24+
// Tarantool Enterprise Edition (EE).
2525
ChapSha1Auth
2626
// PapSha256Auth forces pap-sha256 authentication method. The method is
2727
// available only for the Tarantool Enterprise Edition (EE) with

boxerror.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const (
2626
// MP_ERROR_STACK object with a link to the previous stack error.
2727
// See https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_error/error/
2828
//
29-
// Since 1.10.0
29+
// Since 1.10.0.
3030
type BoxError struct {
3131
// Type is error type that implies its source (for example, "ClientError").
3232
Type string

boxerror_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ func TestErrorTypeEval(t *testing.T) {
300300
test_helpers.SkipIfErrorMessagePackTypeUnsupported(t)
301301

302302
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
303-
defer conn.Close()
303+
defer func() { _ = conn.Close() }()
304304

305305
for name, testcase := range tupleCases {
306306
t.Run(name, func(t *testing.T) {
@@ -321,7 +321,7 @@ func TestErrorTypeEvalTyped(t *testing.T) {
321321
test_helpers.SkipIfErrorMessagePackTypeUnsupported(t)
322322

323323
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
324-
defer conn.Close()
324+
defer func() { _ = conn.Close() }()
325325

326326
for name, testcase := range tupleCases {
327327
t.Run(name, func(t *testing.T) {
@@ -341,7 +341,7 @@ func TestErrorTypeInsert(t *testing.T) {
341341
test_helpers.SkipIfErrorMessagePackTypeUnsupported(t)
342342

343343
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
344-
defer conn.Close()
344+
defer func() { _ = conn.Close() }()
345345

346346
truncateEval := fmt.Sprintf("box.space[%q]:truncate()", space)
347347
_, err := conn.Do(NewEvalRequest(truncateEval).Args([]interface{}{})).Get()
@@ -379,7 +379,7 @@ func TestErrorTypeInsertTyped(t *testing.T) {
379379
test_helpers.SkipIfErrorMessagePackTypeUnsupported(t)
380380

381381
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
382-
defer conn.Close()
382+
defer func() { _ = conn.Close() }()
383383

384384
truncateEval := fmt.Sprintf("box.space[%q]:truncate()", space)
385385
_, err := conn.Do(NewEvalRequest(truncateEval).Args([]interface{}{})).Get()
@@ -421,7 +421,7 @@ func TestErrorTypeSelect(t *testing.T) {
421421
test_helpers.SkipIfErrorMessagePackTypeUnsupported(t)
422422

423423
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
424-
defer conn.Close()
424+
defer func() { _ = conn.Close() }()
425425

426426
truncateEval := fmt.Sprintf("box.space[%q]:truncate()", space)
427427
_, err := conn.Do(NewEvalRequest(truncateEval).Args([]interface{}{})).Get()
@@ -470,7 +470,7 @@ func TestErrorTypeSelectTyped(t *testing.T) {
470470
test_helpers.SkipIfErrorMessagePackTypeUnsupported(t)
471471

472472
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
473-
defer conn.Close()
473+
defer func() { _ = conn.Close() }()
474474

475475
truncateEval := fmt.Sprintf("box.space[%q]:truncate()", space)
476476
_, err := conn.Do(NewEvalRequest(truncateEval).Args([]interface{}{})).Get()

connection.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ const (
278278
RLimitWait
279279
)
280280

281-
// Opts is a way to configure Connection
281+
// Opts is a way to configure Connection.
282282
type Opts struct {
283283
// Timeout for response to a particular request. The timeout is reset when
284284
// push messages are received. If Timeout is zero, any request can be
@@ -499,7 +499,7 @@ func (conn *Connection) dial(ctx context.Context) error {
499499
})
500500

501501
if err != nil {
502-
c.Close()
502+
_ = c.Close()
503503
return fmt.Errorf("unable to register watch: %w", err)
504504
}
505505

@@ -900,7 +900,8 @@ func (conn *Connection) reader(r io.Reader, c Conn) {
900900
return
901901
}
902902

903-
if code == iproto.IPROTO_EVENT {
903+
switch code {
904+
case iproto.IPROTO_EVENT:
904905
if event, err := readWatchEvent(&buf); err == nil {
905906
events <- event
906907
} else {
@@ -910,10 +911,9 @@ func (conn *Connection) reader(r io.Reader, c Conn) {
910911
}
911912
conn.opts.Logger.Report(LogWatchEventReadFailed, conn, err)
912913
}
913-
continue
914-
} else if code == iproto.IPROTO_CHUNK {
914+
case iproto.IPROTO_CHUNK:
915915
conn.opts.Logger.Report(LogBoxSessionPushUnsupported, conn, header)
916-
} else {
916+
default:
917917
resps <- resp{header: header, buf: buf}
918918
}
919919
}
@@ -1298,7 +1298,8 @@ func (conn *Connection) NewPrepared(expr string) (*Prepared, error) {
12981298
//
12991299
// Since v. 2.10.0, Tarantool supports streams and interactive transactions over them.
13001300
// To use interactive transactions, memtx_use_mvcc_engine box option should be set to true.
1301-
// Since 1.7.0
1301+
//
1302+
// Since 1.7.0.
13021303
func (conn *Connection) NewStream() (*Stream, error) {
13031304
next := atomic.AddUint64(&conn.lastStreamId, 1)
13041305
return &Stream{
@@ -1445,7 +1446,7 @@ func isFeatureInSlice(expected iproto.Feature, actualSlice []iproto.Feature) boo
14451446
// See:
14461447
// https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_events/#box-watchers
14471448
//
1448-
// Since 1.10.0
1449+
// Since 1.10.0.
14491450
func (conn *Connection) NewWatcher(key string, callback WatchCallback) (Watcher, error) {
14501451
// We need to check the feature because the IPROTO_WATCH request is
14511452
// asynchronous. We do not expect any response from a Tarantool instance
@@ -1548,7 +1549,8 @@ func (conn *Connection) newWatcherImpl(key string, callback WatchCallback) (Watc
15481549
// ProtocolInfo returns protocol version and protocol features
15491550
// supported by connected Tarantool server. Beware that values might be
15501551
// outdated if connection is in a disconnected state.
1551-
// Since 2.0.0
1552+
//
1553+
// Since 2.0.0.
15521554
func (conn *Connection) ProtocolInfo() ProtocolInfo {
15531555
return conn.serverProtocolInfo.Clone()
15541556
}

crud/result.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,24 @@ func (r *Result) DecodeMsgpack(d *msgpack.Decoder) error {
139139
return err
140140
}
141141

142-
if msgpackIsArray(code) {
142+
switch {
143+
case msgpackIsArray(code):
143144
crudErr := newErrorMany(r.rowType)
144145
if err := d.Decode(&crudErr); err != nil {
145146
return err
146147
}
147148
if crudErr != nil {
148149
return *crudErr
149150
}
150-
} else if code != msgpcode.Nil {
151+
case code != msgpcode.Nil:
151152
crudErr := newError(r.rowType)
152153
if err := d.Decode(&crudErr); err != nil {
153154
return err
154155
}
155156
if crudErr != nil {
156157
return *crudErr
157158
}
158-
} else {
159+
default:
159160
if err := d.DecodeNil(); err != nil {
160161
return err
161162
}

0 commit comments

Comments
 (0)