File tree Expand file tree Collapse file tree 6 files changed +74
-18
lines changed Expand file tree Collapse file tree 6 files changed +74
-18
lines changed Original file line number Diff line number Diff line change 5
5
- master
6
6
jobs :
7
7
golangci-lint :
8
- name : runner / golangci-lint
8
+ name : golangci-lint
9
9
runs-on : ubuntu-latest
10
10
steps :
11
11
- name : Check out code into the Go module directory
12
- uses : actions/checkout@v1
13
- - name : golangci-lint
14
- uses : reviewdog/action-golangci-lint@v1
12
+ uses : actions/checkout@v2
13
+ - name : Set up Go
14
+ uses : actions/setup-go@v2
15
15
with :
16
- github_token : ${{ secrets.github_token }}
16
+ go-version : 1.19
17
+ - uses : actions/cache@v2
18
+ with :
19
+ path : |
20
+ ~/.cache/go-build
21
+ ~/go/pkg/mod
22
+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
23
+ restore-keys : |
24
+ ${{ runner.os }}-go-
25
+ - name : Lint
26
+ run : |
27
+ make lint
Original file line number Diff line number Diff line change 3
3
cmd /dataplaneapi /*
4
4
.vscode /
5
5
.test /
6
+ bin /golangci-lint
Original file line number Diff line number Diff line change @@ -34,12 +34,12 @@ golangci-lint:
34
34
paths :
35
35
- build
36
36
image :
37
- name : $CI_REGISTRY_GO/lint :1.50.0
37
+ name : $CI_REGISTRY_GO/golang :1.19
38
38
entrypoint : [""]
39
39
tags :
40
40
- go
41
41
script :
42
- - golangci-lint run --timeout 5m --color always --max-issues-per-linter 0 --max-same-issues 0
42
+ - make lint
43
43
rules :
44
44
- if : $CI_PIPELINE_SOURCE == 'merge_request_event'
45
45
- if : $CI_PIPELINE_SOURCE == 'push'
Original file line number Diff line number Diff line change @@ -4,27 +4,58 @@ linters-settings:
4
4
golint :
5
5
min-confidence : 0
6
6
gocyclo :
7
- min-complexity : 25
7
+ min-complexity : 42
8
8
maligned :
9
9
suggest-new : true
10
10
dupl :
11
11
threshold : 200
12
12
goconst :
13
13
min-len : 2
14
14
min-occurrences : 2
15
-
15
+ revive :
16
+ rules :
17
+ - name : var-naming
18
+ severity : warning
19
+ disabled : true
16
20
linters :
17
- enable :
18
- - golint
19
- - gocritic
20
- - stylecheck
21
- - goimports
22
- - gosec
23
- - unconvert
21
+ enable-all : true
24
22
disable :
25
- - maligned
26
- - prealloc
23
+ - dupl
24
+ - exhaustive
25
+ - exhaustivestruct
26
+ - funlen
27
+ - gci
27
28
- gochecknoglobals
29
+ - gocognit
30
+ - goconst
31
+ - gocyclo
32
+ - godot
33
+ - goerr113
34
+ - gomnd
35
+ - lll
36
+ - nestif
37
+ - nlreturn
38
+ - wrapcheck
39
+ - wsl
40
+ - nakedret
41
+ - paralleltest
42
+ - testpackage
43
+ - varnamelen
44
+ - nosnakecase
45
+ - exhaustruct
46
+ - nonamedreturns
47
+ - forcetypeassert
48
+ - golint # deprecated
49
+ - varcheck # deprecated
50
+ - ifshort # deprecated
51
+ - structcheck # deprecated
52
+ - maligned # deprecated
53
+ - scopelint # deprecated
54
+ - interfacer # deprecated
55
+ - deadcode # deprecated
56
+ - rowserrcheck # rowserrcheck is disabled because of generics
57
+ - sqlclosecheck # rowserrcheck is disabled because of generics
58
+ - wastedassign # rowserrcheck is disabled because of generics
28
59
29
60
issues :
30
61
exclude-rules :
Original file line number Diff line number Diff line change @@ -9,12 +9,18 @@ GIT_MODIFIED=${GIT_MODIFIED1}${GIT_MODIFIED2}
9
9
SWAGGER_VERSION =${shell curl -s https://raw.githubusercontent.com/haproxytech/client-native/master/Makefile | grep SWAGGER_VERSION -m 1 | awk -F"=" '{print $$2}'}
10
10
BUILD_DATE =$(shell date -u '+% Y-% m-% dT% H:% M:% SZ')
11
11
CGO_ENABLED? =0
12
+ GOLANGCI_LINT_VERSION =1.50.1
12
13
13
14
all : update clean build
14
15
15
16
update :
16
17
go mod tidy
17
18
19
+ .PHONY : lint
20
+ lint :
21
+ cd bin; GOLANGCI_LINT_VERSION=${GOLANGCI_LINT_VERSION} sh lint-check.sh
22
+ bin/golangci-lint run --timeout 5m --color always --max-issues-per-linter 0 --max-same-issues 0
23
+
18
24
clean :
19
25
rm -rf ${DATAPLANEAPI_PATH} /build
20
26
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ V=$( ./golangci-lint --version)
3
+
4
+ case " $V " in
5
+ * $GOLANGCI_LINT_VERSION * ) echo " $V " ;;
6
+ * ) curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $( pwd) " v$GOLANGCI_LINT_VERSION " ;;
7
+ esac
You can’t perform that action at this time.
0 commit comments