Skip to content

Commit e6353dd

Browse files
authored
Merge pull request #71 from bpineau/adopt-golangci-lint
Replace gometalinter by golangci-lint
2 parents 988edd4 + e96cbd9 commit e6353dd

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

Makefile

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,19 @@
1-
21
all: build
32

3+
GOLANGCI_VERSION="1.12.5"
44
tools:
5-
which gometalinter || ( go get -u github.com/alecthomas/gometalinter && gometalinter --install )
5+
which golangci-lint || ( \
6+
curl -sfL "https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_VERSION}/golangci-lint-${GOLANGCI_VERSION}-linux-amd64.tar.gz" | \
7+
tar xz --strip-components 1 --wildcards '*/golangci-lint' && \
8+
chmod 755 golangci-lint && \
9+
mv golangci-lint ${GOPATH}/bin/ \
10+
)
611
which glide || go get -u github.com/Masterminds/glide
712
which goveralls || go get github.com/mattn/goveralls
813

914
lint:
10-
gometalinter --concurrency=1 --deadline=300s --vendor --disable-all \
11-
--enable=golint \
12-
--enable=vet \
13-
--enable=vetshadow \
14-
--enable=varcheck \
15-
--enable=errcheck \
16-
--enable=structcheck \
17-
--enable=deadcode \
18-
--enable=ineffassign \
19-
--enable=dupl \
20-
--enable=gotype \
21-
--enable=varcheck \
22-
--enable=interfacer \
23-
--enable=goconst \
24-
--enable=megacheck \
25-
--enable=unparam \
26-
--enable=misspell \
27-
--enable=goimports \
28-
./...
15+
@# vet, errcheck, deadcode, etc are already enabled by default; here we just add more checks:
16+
golangci-lint run -E gofmt,golint,unconvert,dupl,goimports,misspell,maligned
2917

3018
man:
3119
go run assets/manpage.go

pkg/controller/controller_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ var (
109109
)
110110

111111
func TestController(t *testing.T) {
112-
flag.Lookup("logtostderr").Value.Set("true")
112+
if err := flag.Lookup("logtostderr").Value.Set("true"); err != nil {
113+
t.Errorf("failed to set logs flags: %v", err)
114+
}
113115

114116
client := fakecontroller.NewFakeControllerSource()
115117

0 commit comments

Comments
 (0)