Skip to content

Commit 15d2a5a

Browse files
committed
Switch Go linting to use golangci-lint
Signed-off-by: Austin Vazquez <[email protected]>
1 parent c9b5d0e commit 15d2a5a

File tree

4 files changed

+32
-25
lines changed

4 files changed

+32
-25
lines changed

.github/workflows/build-pr.yml

+15-5
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,32 @@ jobs:
1111
steps:
1212
- name: checkout source code
1313
uses: actions/checkout@master
14+
1415
- name: setup go environment
1516
uses: actions/setup-go@v1
1617
with:
1718
go-version: '1.17.2'
19+
20+
- name: create go.mod
21+
run: |
22+
# Fix for "cannot find main module" issue
23+
go mod init github.com/opencontainers/runtime-spec
24+
25+
go get -d ./schema/...
26+
27+
- name: run golangci-lint
28+
uses: golangci/golangci-lint-action@v3
29+
with:
30+
version: v1.51.2
31+
args: --verbose
32+
1833
- name: run tests
1934
run: |
2035
export PATH="$(go env GOPATH)/bin:${PATH}"
2136
set -x
2237
make install.tools
2338
24-
# Fix for "cannot find main module" issue
25-
go mod init github.com/opencontainers/runtime-spec
26-
27-
go get -d ./schema/...
2839
make .govet
29-
make .golint
3040
3141
make .gitvalidation
3242
make docs

.github/workflows/build.yml

+15-5
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,32 @@ jobs:
1111
steps:
1212
- name: checkout source code
1313
uses: actions/checkout@master
14+
1415
- name: setup go environment
1516
uses: actions/setup-go@v1
1617
with:
1718
go-version: '1.17.2'
19+
20+
- name: create go.mod
21+
run: |
22+
# Fix for "cannot find main module" issue
23+
go mod init github.com/opencontainers/runtime-spec
24+
25+
go get -d ./schema/...
26+
27+
- name: run golangci-lint
28+
uses: golangci/golangci-lint-action@v3
29+
with:
30+
version: v1.51.2
31+
args: --verbose
32+
1833
- name: run tests
1934
run: |
2035
export PATH="$(go env GOPATH)/bin:${PATH}"
2136
set -x
2237
make install.tools
2338
24-
# Fix for "cannot find main module" issue
25-
go mod init github.com/opencontainers/runtime-spec
26-
27-
go get -d ./schema/...
2839
make .govet
29-
make .golint
3040
3141
make .gitvalidation
3242
make docs

.tool/version-doc.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build ignore
12
// +build ignore
23

34
package main

Makefile

+1-15
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ test: .govet .golint .gitvalidation
6161
.govet:
6262
go vet -x ./...
6363

64-
# `go get github.com/golang/lint/golint`
65-
.golint:
66-
ifeq ($(call ALLOWED_GO_VERSION,1.7,$(HOST_GOLANG_VERSION)),true)
67-
@which golint > /dev/null 2>/dev/null || (echo "ERROR: golint not found. Consider 'make install.tools' target" && false)
68-
golint ./...
69-
endif
70-
71-
7264
# When this is running in GitHub, it will only check the GitHub commit range
7365
.gitvalidation:
7466
@which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make install.tools' target" && false)
@@ -78,13 +70,7 @@ else
7870
git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..HEAD
7971
endif
8072

81-
install.tools: .install.golint .install.gitvalidation
82-
83-
# golint does not even build for <go1.7
84-
.install.golint:
85-
ifeq ($(call ALLOWED_GO_VERSION,1.7,$(HOST_GOLANG_VERSION)),true)
86-
go get -u golang.org/x/lint/golint
87-
endif
73+
install.tools: .install.gitvalidation
8874

8975
.install.gitvalidation:
9076
go get -u github.com/vbatts/git-validation

0 commit comments

Comments
 (0)