Skip to content

Commit d3cd202

Browse files
committed
*: switch to golangci-lint
Signed-off-by: Vincent Batts <[email protected]>
1 parent a5463b7 commit d3cd202

File tree

6 files changed

+1330
-24
lines changed

6 files changed

+1330
-24
lines changed

.github/workflows/docs-and-linting.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
go: ['1.15', '1.16', '1.17']
12+
go: ['1.16', '1.17']
1313

1414
name: Documentation and Linting
1515
steps:
@@ -30,8 +30,6 @@ jobs:
3030
export PATH=$GOPATH/bin:$PATH
3131
cd go/src/github.com/opencontainers/image-spec
3232
make install.tools
33-
go get -u github.com/alecthomas/gometalinter
34-
gometalinter --install
3533
go get -t -d ./...
3634
ls ../
3735
make

.golangci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
run:
2+
timeout: 10m
3+
4+
linters:
5+
disable-all: true
6+
enable:
7+
- deadcode
8+
- dupl
9+
- gofmt
10+
- goimports
11+
- gosimple
12+
- govet
13+
- ineffassign
14+
- misspell
15+
- nakedret
16+
- revive
17+
- structcheck
18+
- unused
19+
- varcheck
20+
- staticcheck
21+
22+
linters-settings:
23+
gofmt:
24+
simplify: true
25+
dupl:
26+
threshold: 400

.tool/lint

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,4 @@ set -o errexit
44
set -o nounset
55
set -o pipefail
66

7-
if [ ! $(command -v gometalinter) ]; then
8-
go get -u github.com/alecthomas/gometalinter
9-
gometalinter --install
10-
fi
11-
12-
for d in $(find . -type d -not -iwholename '*.git*' -a -not -iname '.tool' -a -not -iwholename '*vendor*'); do
13-
gometalinter \
14-
--exclude='error return value not checked.*(Close|Log|Print).*\(errcheck\)$' \
15-
--exclude='.*_test\.go:.*error return value not checked.*\(errcheck\)$' \
16-
--exclude='duplicate of.*_test.go.*\(dupl\)$' \
17-
--exclude='schema/fs.go' \
18-
--disable=aligncheck \
19-
--disable=gotype \
20-
--disable=gas \
21-
--cyclo-over=35 \
22-
--tests \
23-
--deadline=60s "${d}"
24-
done
7+
GO111MODULE=on golangci-lint run

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ check-license:
9292
@echo "checking license headers"
9393
@./.tool/check-license
9494

95-
lint:
95+
lint: .install.lint
9696
@echo "checking lint"
9797
@./.tool/lint
9898

@@ -114,6 +114,9 @@ endif
114114

115115
install.tools: $(TOOLS:%=.install.%)
116116

117+
.install.lint:
118+
go get github.com/golangci/golangci-lint/cmd/golangci-lint@latest
119+
117120
.install.esc:
118121
go get -u github.com/mjibson/esc
119122

go.mod

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ module github.com/opencontainers/image-spec
33
go 1.11
44

55
require (
6+
github.com/davecgh/go-spew v1.1.1 // indirect
7+
github.com/golangci/golangci-lint v1.43.0 // indirect
8+
github.com/kr/text v0.2.0 // indirect
9+
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
610
github.com/opencontainers/go-digest v1.0.0
711
github.com/pkg/errors v0.9.1
812
github.com/russross/blackfriday v1.6.0
13+
github.com/stretchr/testify v1.7.0 // indirect
914
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415
1015
github.com/xeipuuv/gojsonschema v1.2.0
16+
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
17+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
1118
)

0 commit comments

Comments
 (0)