Skip to content

Commit 1fa7026

Browse files
committed
Add golangci-lint config
1 parent 7634a77 commit 1fa7026

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ jobs:
3030
- name: Lint Code
3131
uses: golangci/golangci-lint-action@v2
3232
with:
33-
args: --timeout ${{ env.GOLANGCI_TIMEOUT }} --issues-exit-code=0 ./client/...
33+
args: --timeout ${{ env.GOLANGCI_TIMEOUT }}

.golangci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
linters-settings:
2+
misspell:
3+
locale: US
4+
5+
linters:
6+
enable:
7+
- asciicheck
8+
- deadcode
9+
- errcheck
10+
- errorlint
11+
- gofmt
12+
- gofumpt
13+
- goimports
14+
- gosec
15+
- gosimple
16+
- govet
17+
- ineffassign
18+
- makezero
19+
- misspell
20+
- nilerr
21+
- noctx
22+
- predeclared
23+
- staticcheck
24+
- structcheck
25+
- typecheck
26+
- unconvert
27+
- unparam
28+
- unused
29+
- varcheck
30+
- wastedassign
31+
disable-all: true
32+
issues:
33+
max-issues-per-linter: 0
34+
max-same-issues: 0

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ DOCKER_NGINX_PLUS?=nginx-plus
66
DOCKER_NGINX_PLUS_HELPER?=nginx-plus-helper
77

88
GOLANG_CONTAINER=golang:1.16
9-
GOLANGCI_CONTAINER=golangci/golangci-lint:latest
109

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

1716
lint:
18-
docker run --rm \
19-
-v $(shell pwd):/go/src/github.com/nginxinc/nginx-plus-go-client \
20-
-w /go/src/github.com/nginxinc/nginx-plus-go-client \
21-
$(GOLANGCI_CONTAINER) golangci-lint run
17+
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
2218

2319
docker-build:
2420
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

0 commit comments

Comments
 (0)