Skip to content

Commit fc94d25

Browse files
authored
chore(linter): update golangci to v2 (#1168)
1 parent 0551e43 commit fc94d25

271 files changed

Lines changed: 2584 additions & 871 deletions

File tree

Some content is hidden

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

.github/workflows/lint-go.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ jobs:
2929
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@v0.18.1 ./...
3030
3131
- name: golangci-lint
32-
uses: golangci/golangci-lint-action@v6.4.1
32+
uses: golangci/golangci-lint-action@v8
3333
with:
34-
version: v1.64.8
34+
version: v2.2.1
3535
# use the default if on main branch, otherwise use the pull request config
3636
args: --timeout=30m --config=.golangci.yml
3737
only-new-issues: false

.golangci.yml

Lines changed: 63 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,76 @@
1-
# Please refer to the official golangci-lint config documentation for more details:
2-
# https://golangci-lint.run/usage/configuration/
3-
# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
1+
version: "2"
42
run:
5-
timeout: 10m
63
tests: true
7-
# default is true. Enables skipping of directories:
8-
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
9-
exclude-dirs-use-default: true
10-
4+
timeout: 10m
115
linters:
12-
disable-all: true
6+
default: none
137
enable:
14-
- goimports
15-
- gosimple
8+
- bidichk
9+
- copyloopvar
10+
- durationcheck
11+
- gosec
1612
- govet
1713
- ineffassign
1814
- misspell
15+
- revive
16+
- staticcheck
1917
- unconvert
20-
- typecheck
2118
- unused
22-
- staticcheck
23-
- bidichk
24-
- durationcheck
25-
- copyloopvar
2619
- whitespace
27-
- gosec
28-
- revive
29-
30-
# - structcheck # lots of false positives
31-
# - errcheck #lot of false positives
32-
# - contextcheck
33-
# - errchkjson # lots of false positives
34-
# - errorlint # this check crashes
35-
# - exhaustive # silly check
36-
# - makezero # false positives
37-
# - nilerr # several intentional
38-
39-
linters-settings:
40-
gofmt:
41-
simplify: true
42-
gosec:
43-
excludes:
44-
- G115
45-
- G406 # ignore ripe160 deprecation
46-
- G507 # ignore ripe160 deprecation
47-
revive:
20+
settings:
21+
gosec:
22+
excludes:
23+
- G115
24+
- G406
25+
- G507
26+
revive:
27+
rules:
28+
- name: var-naming
29+
arguments:
30+
- []
31+
- []
32+
- - upperCaseConst: true
33+
severity: warning
34+
disabled: false
35+
exclude:
36+
- ""
37+
exclusions:
38+
generated: lax
39+
presets:
40+
- comments
41+
- common-false-positives
42+
- legacy
43+
- std-error-handling
4844
rules:
49-
- name: var-naming
50-
severity: warning
51-
disabled: false
52-
exclude: [""]
53-
arguments:
54-
- [] # AllowList
55-
- [] # DenyList
56-
- - upperCaseConst: true # Extra parameter (upperCaseConst|skipPackageNameChecks)
57-
45+
- path: vm/contracts.go
46+
text: 'SA1019: "golang.org/x/crypto/ripemd160" is deprecated: RIPEMD-160 is a legacy hash and should not be used for new applications.'
47+
paths:
48+
- third_party$
49+
- builtin$
50+
- examples$
5851
issues:
5952
max-issues-per-linter: 1000
60-
exclude-rules:
61-
- path: vm/contracts.go
62-
text: 'SA1019: "golang.org/x/crypto/ripemd160" is deprecated: RIPEMD-160 is a legacy hash and should not be used for new applications.'
53+
formatters:
54+
enable:
55+
- goimports
56+
- gofmt
57+
- gofumpt
58+
- golines
59+
settings:
60+
gofmt:
61+
simplify: true
62+
goimports:
63+
local-prefixes:
64+
- github.com/vechain/thor
65+
golines:
66+
max-len: 160
67+
tab-len: 4
68+
shorten-comments: true
69+
# Default: true
70+
reformat-tags: false
71+
exclusions:
72+
generated: lax
73+
paths:
74+
- third_party$
75+
- builtin$
76+
- examples$

abi/abi.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"errors"
1111

1212
ethabi "github.com/ethereum/go-ethereum/accounts/abi"
13+
1314
"github.com/vechain/thor/v2/thor"
1415
)
1516

abi/abi_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"github.com/ethereum/go-ethereum/common"
1313
"github.com/stretchr/testify/assert"
14+
1415
"github.com/vechain/thor/v2/abi"
1516
"github.com/vechain/thor/v2/builtin/gen"
1617
"github.com/vechain/thor/v2/thor"

abi/event.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package abi
77

88
import (
99
ethabi "github.com/ethereum/go-ethereum/accounts/abi"
10+
1011
"github.com/vechain/thor/v2/thor"
1112
)
1213

api/account_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package api
88
import (
99
"github.com/ethereum/go-ethereum/common/hexutil"
1010
"github.com/ethereum/go-ethereum/common/math"
11+
1112
"github.com/vechain/thor/v2/runtime"
1213
"github.com/vechain/thor/v2/thor"
1314
)

0 commit comments

Comments
 (0)