File tree 6 files changed +281
-0
lines changed
6 files changed +281
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : golangci-lint
2
+ on :
3
+ push :
4
+ branches :
5
+ - main
6
+ pull_request :
7
+
8
+ permissions :
9
+ contents : read
10
+ pull-requests : read
11
+
12
+ env :
13
+ GO_VERSION : stable
14
+ GOLANGCI_LINT_VERSION : v1.59
15
+
16
+ jobs :
17
+ detect-modules :
18
+ runs-on : ubuntu-latest
19
+ outputs :
20
+ modules : ${{ steps.set-modules.outputs.modules }}
21
+ steps :
22
+ - uses : actions/checkout@v4
23
+ - uses : actions/setup-go@v5
24
+ with :
25
+ go-version : ${{ env.GO_VERSION }}
26
+ - id : set-modules
27
+ run : echo "modules=$(go list -m -json | jq -s '.' | jq -c '[.[].Dir]')" >> $GITHUB_OUTPUT
28
+
29
+ golangci :
30
+ name : lint
31
+ needs : detect-modules
32
+ runs-on : ubuntu-latest
33
+ strategy :
34
+ matrix :
35
+ modules : ${{ fromJSON(needs.detect-modules.outputs.modules) }}
36
+ fail-fast : false
37
+ steps :
38
+ - uses : actions/checkout@v4
39
+ - uses : actions/setup-go@v5
40
+ with :
41
+ go-version : ${{ env.GO_VERSION }}
42
+ - name : golangci-lint ${{ matrix.modules }}
43
+ uses : golangci/golangci-lint-action@v6
44
+ with :
45
+ version : ${{ env.GOLANGCI_LINT_VERSION }}
46
+ working-directory : ${{ matrix.modules }}
47
+
48
+ test :
49
+ needs : detect-modules
50
+ runs-on : ubuntu-latest
51
+ strategy :
52
+ matrix :
53
+ modules : ${{ fromJSON(needs.detect-modules.outputs.modules) }}
54
+ fail-fast : false
55
+ steps :
56
+ - uses : actions/checkout@v4
57
+ - uses : actions/setup-go@v5
58
+ with :
59
+ go-version : ${{ env.GO_VERSION }}
60
+ - name : Test with the Go CLI
61
+ with :
62
+ working-directory : ${{ matrix.modules }}
63
+ run : go test -race
Original file line number Diff line number Diff line change
1
+ output :
2
+ formats :
3
+ - format : colored-line-number
4
+ print-issued-lines : true
5
+ print-linter-name : true
6
+
7
+ linters-settings :
8
+ gocognit :
9
+ min-complexity : 10
10
+ goconst :
11
+ min-len : 2
12
+ min-occurrences : 2
13
+ gosec :
14
+ excludes :
15
+ # _ instead of err checks
16
+ - G104
17
+ govet :
18
+ enable-all : true
19
+ nakedret :
20
+ max-func-lines : 10
21
+ nolintlint :
22
+ require-specific : true
23
+ prealloc :
24
+ range-loops : true
25
+ revive :
26
+ rules :
27
+ - name : unexported-return
28
+ disabled : true
29
+ staticcheck :
30
+ # SA5001: Allow to ignore returned error before deferring *.Close()
31
+ checks : ["all", "-SA5001"]
32
+
33
+ linters :
34
+ disable-all : true
35
+ enable :
36
+ - bodyclose
37
+ - errcheck
38
+ - errorlint
39
+ - exportloopref
40
+ - gocheckcompilerdirectives
41
+ - gocognit
42
+ - goconst
43
+ - goimports
44
+ - gosec
45
+ - gosimple
46
+ - govet
47
+ - ineffassign
48
+ - makezero
49
+ - mnd
50
+ - nakedret
51
+ - noctx
52
+ - nolintlint
53
+ - nosprintfhostport
54
+ - prealloc
55
+ - revive
56
+ - staticcheck
57
+ - tenv
58
+ - testpackage
59
+ - typecheck
60
+ - unconvert
61
+ - unused
62
+ - wastedassign
63
+
64
+ issues :
65
+ exclude-rules :
66
+ - path : ' (.+)_test\.go'
67
+ linters :
68
+ - gocognit
Original file line number Diff line number Diff line change
1
+ output :
2
+ formats :
3
+ - format : colored-line-number
4
+ print-issued-lines : true
5
+ print-linter-name : true
6
+
7
+ linters-settings :
8
+ gocognit :
9
+ min-complexity : 10
10
+ goconst :
11
+ min-len : 2
12
+ min-occurrences : 2
13
+ gosec :
14
+ excludes :
15
+ # _ instead of err checks
16
+ - G104
17
+ govet :
18
+ enable-all : true
19
+ nakedret :
20
+ max-func-lines : 10
21
+ nolintlint :
22
+ require-specific : true
23
+ prealloc :
24
+ range-loops : true
25
+ revive :
26
+ rules :
27
+ - name : unexported-return
28
+ disabled : true
29
+ staticcheck :
30
+ # SA5001: Allow to ignore returned error before deferring *.Close()
31
+ checks : ["all", "-SA5001"]
32
+
33
+ linters :
34
+ disable-all : true
35
+ enable :
36
+ - bodyclose
37
+ - errcheck
38
+ - errorlint
39
+ - exportloopref
40
+ - gocheckcompilerdirectives
41
+ - gocognit
42
+ - goconst
43
+ - goimports
44
+ - gosec
45
+ - gosimple
46
+ - govet
47
+ - ineffassign
48
+ - makezero
49
+ - mnd
50
+ - nakedret
51
+ - noctx
52
+ - nolintlint
53
+ - nosprintfhostport
54
+ - prealloc
55
+ - revive
56
+ - staticcheck
57
+ - tenv
58
+ - testpackage
59
+ - typecheck
60
+ - unconvert
61
+ - unused
62
+ - wastedassign
63
+
64
+ issues :
65
+ exclude-rules :
66
+ - path : ' ctxkey\.go'
67
+ linters :
68
+ - goimports
69
+ - path : ' (.+)_test\.go'
70
+ linters :
71
+ - gocognit
Original file line number Diff line number Diff line change
1
+ go 1.20
2
+
3
+ use (
4
+ ./closer
5
+ ./ctxkey
6
+ ./time
7
+ )
Original file line number Diff line number Diff line change
1
+ github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w =
2
+ github.com/kr/pretty v0.1.0 /go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo =
3
+ github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY =
4
+ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 /go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0 =
Original file line number Diff line number Diff line change
1
+ output :
2
+ formats :
3
+ - format : colored-line-number
4
+ print-issued-lines : true
5
+ print-linter-name : true
6
+
7
+ linters-settings :
8
+ gocognit :
9
+ min-complexity : 10
10
+ goconst :
11
+ min-len : 2
12
+ min-occurrences : 2
13
+ gosec :
14
+ excludes :
15
+ # _ instead of err checks
16
+ - G104
17
+ govet :
18
+ enable-all : true
19
+ nakedret :
20
+ max-func-lines : 10
21
+ nolintlint :
22
+ require-specific : true
23
+ prealloc :
24
+ range-loops : true
25
+ revive :
26
+ rules :
27
+ - name : unexported-return
28
+ disabled : true
29
+ staticcheck :
30
+ # SA5001: Allow to ignore returned error before deferring *.Close()
31
+ checks : ["all", "-SA5001"]
32
+
33
+ linters :
34
+ disable-all : true
35
+ enable :
36
+ - bodyclose
37
+ - errcheck
38
+ - errorlint
39
+ - exportloopref
40
+ - gocheckcompilerdirectives
41
+ - gocognit
42
+ - goconst
43
+ - goimports
44
+ - gosec
45
+ - gosimple
46
+ - govet
47
+ - ineffassign
48
+ - makezero
49
+ - mnd
50
+ - nakedret
51
+ - noctx
52
+ - nolintlint
53
+ - nosprintfhostport
54
+ - prealloc
55
+ - revive
56
+ - staticcheck
57
+ - tenv
58
+ - testpackage
59
+ - typecheck
60
+ - unconvert
61
+ - unused
62
+ - wastedassign
63
+
64
+ issues :
65
+ exclude-rules :
66
+ - path : ' (.+)_test\.go'
67
+ linters :
68
+ - gocognit
You can’t perform that action at this time.
0 commit comments