Switch linter to golangci-lint

This commit is contained in:
Henry Jenkins 2019-06-23 20:40:59 +01:00
parent 317f09f41e
commit 411adf6f21
8 changed files with 22 additions and 15 deletions

14
.golangci.yml Normal file
View File

@ -0,0 +1,14 @@
run:
deadline: 120s
linters:
enable:
- govet
# TODO: Not supported by golang-ci - vetshadow
- golint
- ineffassign
- goconst
- deadcode
- gofmt
- goimports
enable-all: false
disable-all: true

View File

@ -6,8 +6,7 @@ install:
- wget -O dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
- chmod +x dep
- mv dep $GOPATH/bin/dep
- go get github.com/alecthomas/gometalinter
- gometalinter --install
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.17.1
script:
- ./configure && make test
sudo: false

View File

@ -62,6 +62,7 @@
- [#185](https://github.com/pusher/oauth2_proxy/pull/185) Fix an unsupported protocol scheme error during token validation when using the Azure provider (@jonas)
- [#141](https://github.com/pusher/oauth2_proxy/pull/141) Check google group membership based on email address (@bchess)
- Google Group membership is additionally checked via email address, allowing users outside a GSuite domain to be authorized.
- [#XX](https://github.com/pusher/outh2_proxy/pull/XX) Switch from gometalinter to golangci-lint
# v3.2.0

View File

@ -3,6 +3,7 @@ FROM golang:1.12-stretch AS builder
# Download tools
RUN wget -O $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
RUN chmod +x $GOPATH/bin/dep
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.17.1
# Copy sources
WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy

View File

@ -3,6 +3,7 @@ FROM golang:1.12-stretch AS builder
# Download tools
RUN wget -O $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
RUN chmod +x $GOPATH/bin/dep
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.17.1
# Copy sources
WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy

View File

@ -3,6 +3,7 @@ FROM golang:1.12-stretch AS builder
# Download tools
RUN wget -O $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
RUN chmod +x $GOPATH/bin/dep
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.17.1
# Copy sources
WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy

View File

@ -17,17 +17,7 @@ distclean: clean
.PHONY: lint
lint:
$(GOMETALINTER) --vendor --disable-all \
--enable=vet \
--enable=vetshadow \
--enable=golint \
--enable=ineffassign \
--enable=goconst \
--enable=deadcode \
--enable=gofmt \
--enable=goimports \
--deadline=120s \
--tests ./...
$(GOLANGCILINT) run
.PHONY: dep
dep:

4
configure vendored
View File

@ -126,7 +126,7 @@ check_for go
check_go_version
check_go_env
check_for dep
check_for gometalinter
check_for golangci-lint
echo
@ -135,7 +135,7 @@ cat <<- EOF > .env
GO := "${tools[go]}"
GO_VERSION := ${tools[go_version]}
DEP := "${tools[dep]}"
GOMETALINTER := "${tools[gometalinter]}"
GOLANGCILINT := "${tools[golangci-lint]}"
EOF
echo "Environment configuration written to .env"