Skip to content

Commit

Permalink
Add golangci-lint config (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome authored Jun 23, 2021
1 parent 7634a77 commit 6e9ea95
Show file tree
Hide file tree
Showing 7 changed files with 387 additions and 310 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
- name: Lint Code
uses: golangci/golangci-lint-action@v2
with:
args: --timeout ${{ env.GOLANGCI_TIMEOUT }} --issues-exit-code=0 ./client/...
args: --timeout ${{ env.GOLANGCI_TIMEOUT }}
34 changes: 34 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
linters-settings:
misspell:
locale: US

linters:
enable:
- asciicheck
- deadcode
- errcheck
- errorlint
- gofmt
- gofumpt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- makezero
- misspell
- nilerr
- noctx
- predeclared
- staticcheck
- structcheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- wastedassign
disable-all: true
issues:
max-issues-per-linter: 0
max-same-issues: 0
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ DOCKER_NGINX_PLUS?=nginx-plus
DOCKER_NGINX_PLUS_HELPER?=nginx-plus-helper

GOLANG_CONTAINER=golang:1.16
GOLANGCI_CONTAINER=golangci/golangci-lint:latest

export TEST_API_ENDPOINT=http://$(DOCKER_NGINX_PLUS):8080/api
export TEST_API_ENDPOINT_OF_HELPER=http://$(DOCKER_NGINX_PLUS_HELPER):8080/api
Expand All @@ -15,10 +14,7 @@ export TEST_UNAVAILABLE_STREAM_ADDRESS=$(DOCKER_NGINX_PLUS):8081
test: docker-build run-nginx-plus test-run configure-no-stream-block test-run-no-stream-block clean

lint:
docker run --rm \
-v $(shell pwd):/go/src/github.com/nginxinc/nginx-plus-go-client \
-w /go/src/github.com/nginxinc/nginx-plus-go-client \
$(GOLANGCI_CONTAINER) golangci-lint run
docker run --pull always --rm -v $(shell pwd):/nginx-plus-go-client -w /nginx-plus-go-client -v $(shell go env GOCACHE):/cache/go -e GOCACHE=/cache/go -e GOLANGCI_LINT_CACHE=/cache/go -v $(shell go env GOPATH)/pkg:/go/pkg golangci/golangci-lint:latest golangci-lint --color always run

docker-build:
docker build --secret id=nginx-repo.crt,src=docker/nginx-repo.crt --secret id=nginx-repo.key,src=docker/nginx-repo.key --build-arg NGINX_PLUS_VERSION=$(NGINX_PLUS_VERSION) -t $(NGINX_IMAGE) docker
Expand Down
Loading

0 comments on commit 6e9ea95

Please sign in to comment.