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 - wget -O dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
- chmod +x dep - chmod +x dep
- mv dep $GOPATH/bin/dep - mv dep $GOPATH/bin/dep
- go get github.com/alecthomas/gometalinter - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.17.1
- gometalinter --install
script: script:
- ./configure && make test - ./configure && make test
sudo: false 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) - [#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) - [#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. - 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 # v3.2.0

View File

@ -3,6 +3,7 @@ FROM golang:1.12-stretch AS builder
# Download tools # Download tools
RUN wget -O $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 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 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 # Copy sources
WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy

View File

@ -3,6 +3,7 @@ FROM golang:1.12-stretch AS builder
# Download tools # Download tools
RUN wget -O $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 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 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 # Copy sources
WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy

View File

@ -3,6 +3,7 @@ FROM golang:1.12-stretch AS builder
# Download tools # Download tools
RUN wget -O $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 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 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 # Copy sources
WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy

View File

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

4
configure vendored
View File

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