File tree Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Expand file tree Collapse file tree 3 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 4
4
branches :
5
5
- master
6
6
jobs :
7
+ gofumpt :
8
+ name : gofumpt
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - name : Check out code
12
+ uses : actions/checkout@v2
13
+ - name : Set up Go
14
+ uses : actions/setup-go@v2
15
+ with :
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 : tidy
26
+ run : make gofumpt
27
+ - name : changes
28
+ run : test -z "$(git diff 2> /dev/null)" || exit "Go code not formatted, issue \`make gofumpt\` and commit the result"
7
29
golangci-lint :
8
30
name : golangci-lint
9
31
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 27
27
- make generate-native
28
28
- test -z "$(git diff 2> /dev/null)" || exit "Specification is not generated, issue \`make generate\` and commit the result"
29
29
- test -z "$(git ls-files --others --exclude-standard 2> /dev/null)" || exit "Specification generation created untracked files, cannot proceed"
30
-
31
30
golangci-lint :
32
31
stage : lint
33
32
artifacts :
@@ -43,6 +42,19 @@ golangci-lint:
43
42
rules :
44
43
- if : $CI_PIPELINE_SOURCE == 'merge_request_event'
45
44
- if : $CI_PIPELINE_SOURCE == 'push'
45
+ gofumpt :
46
+ stage : lint
47
+ rules :
48
+ - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
49
+ - if : $CI_PIPELINE_SOURCE == 'push'
50
+ image :
51
+ name : $CI_REGISTRY_GO/golang:1.19
52
+ entrypoint : [""]
53
+ tags :
54
+ - go
55
+ script :
56
+ - make gofumpt
57
+ - test -z "$(git diff 2> /dev/null)" || exit 'Go code not formatted, issue \`make gofumpt\` and commit the result'
46
58
lint-commit-msg :
47
59
stage : lint
48
60
image :
Original file line number Diff line number Diff line change 21
21
cd bin; GOLANGCI_LINT_VERSION=${GOLANGCI_LINT_VERSION} sh lint-check.sh
22
22
bin/golangci-lint run --timeout 5m --color always --max-issues-per-linter 0 --max-same-issues 0
23
23
24
+ .PHONY : gofumpt
25
+ gofumpt :
26
+ go install mvdan.cc/gofumpt@latest
27
+ gofumpt -l -w .
28
+
24
29
clean :
25
30
rm -rf ${DATAPLANEAPI_PATH} /build
26
31
You can’t perform that action at this time.
0 commit comments