File tree 4 files changed +58
-48
lines changed
4 files changed +58
-48
lines changed Original file line number Diff line number Diff line change
1
+ name : " lint-go"
2
+ description : " This action will install go linting tools (golangci-lint and goimports-reviser), and executes them on the codebase."
3
+ inputs :
4
+ cache-dependency-path :
5
+ description : ' Used to specify the path to a dependency file - go.sum'
6
+ strategy :
7
+ description : " See install-go for info"
8
+ _golangci_version :
9
+ description : " Internal: the golangci version we want"
10
+ default : " 89476e7a1eaa0a8a06c17343af960a5fd9e7edb7" # v1.62.2
11
+ _goimports_version :
12
+ description : " Internal: the goimports reviser version we want"
13
+ default : " f034195cc8a7ffc7cc70d60aa3a25500874eaf04" # v3.8.2
14
+
15
+ runs :
16
+ using : composite
17
+ steps :
18
+ - name : " Install golang"
19
+ uses : ./.github/actions/install-go
20
+ with :
21
+ strategy : ${{ inputs.strategy }}
22
+ - name : " `go install` needed tools"
23
+ shell : bash
24
+ run : |
25
+ # go install golangci-lint and goimports-reviser
26
+ err="$(go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@${{ inputs._golangci_version }} 2>&1)" || {
27
+ echo "Failed installing golangci:"
28
+ echo "$err"
29
+ exit 1
30
+ }
31
+ err="$(go install -v github.com/incu6us/goimports-reviser/v3@${{ inputs._goimports_version }} 2>&1)" || {
32
+ echo "Failed installing goimports-reviser:"
33
+ echo "$err"
34
+ exit 1
35
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 12
12
timeout-minutes : 5
13
13
name : " go | ${{ matrix.goos }} | ${{ matrix.goversion }}"
14
14
runs-on : " ${{ matrix.os }}"
15
- defaults :
16
- run :
17
- shell : bash
18
15
strategy :
19
16
matrix :
20
17
include :
@@ -32,37 +29,38 @@ jobs:
32
29
- os : ubuntu-24.04
33
30
goos : linux
34
31
goversion : canary
35
- env :
36
- GOOS : " ${{ matrix.goos }}"
37
32
steps :
38
33
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39
34
with :
40
35
fetch-depth : 1
41
- - name : " Install go"
42
- uses : ./.github/actions/install-go
36
+ - name : " Install go linters "
37
+ uses : ./.github/actions/install-go-linters
43
38
with :
44
39
strategy : ${{ matrix.goversion }}
45
- - name : golangci-lint
46
- uses : golangci/golangci-lint-action@774c35bcccffb734694af9e921f12f57d882ef74 # v6.1.1
47
- with :
48
- args : --verbose
40
+ - name : " `make lint-imports`"
41
+ # Import ordering is not influenced by GOOS - running it multiple times is thus unnecessary
42
+ # Note we are picking freebsd as the GOOS to run it on, as linux is running multiple times (eg: canary)
43
+ if : ${{ inputs.goos=='freebsd' }}
44
+ shell : bash
45
+ run : |
46
+ make lint-imports
47
+ - name : " `make lint-go` for ${{ inputs.goos }} and $GO_VERSION"
48
+ env :
49
+ VERBOSE : true
50
+ GOOS : ${{ inputs.goos }}
51
+ shell : bash
52
+ run : |
53
+ make lint-go
54
+
49
55
other :
50
56
timeout-minutes : 5
51
- name : yaml | shell | imports order
57
+ name : yaml | shell
52
58
runs-on : ubuntu-24.04
53
59
steps :
54
60
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
55
61
with :
56
62
fetch-depth : 1
57
- - name : " Install go"
58
- uses : ./.github/actions/install-go
59
- with :
60
- strategy : latest-stable
61
63
- name : yaml
62
64
run : make lint-yaml
63
65
- name : shell
64
66
run : make lint-shell
65
- - name : go imports ordering
66
- run : |
67
- go install -v github.com/incu6us/goimports-reviser/v3@latest
68
- make lint-imports
Original file line number Diff line number Diff line change @@ -67,13 +67,16 @@ clean:
67
67
find . -name \#\* -delete
68
68
rm -rf $(CURDIR ) /_output/* $(MAKEFILE_DIR ) /vendor
69
69
70
- lint : lint-go lint-imports lint-yaml lint-shell
70
+ lint : lint-go-all lint-imports lint-yaml lint-shell
71
71
72
- lint-go :
72
+ lint-go-all :
73
73
cd $(MAKEFILE_DIR ) && GOOS=linux golangci-lint run $(VERBOSE_FLAG_LONG ) ./... && \
74
74
GOOS=windows golangci-lint run $(VERBOSE_FLAG_LONG ) ./... && \
75
75
GOOS=freebsd golangci-lint run $(VERBOSE_FLAG_LONG ) ./...
76
76
77
+ lint-go :
78
+ cd $(MAKEFILE_DIR ) && golangci-lint run $(VERBOSE_FLAG_LONG ) ./...
79
+
77
80
lint-imports :
78
81
cd $(MAKEFILE_DIR ) && ./hack/lint-imports.sh
79
82
You can’t perform that action at this time.
0 commit comments