Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add golangci-lint config #73

Merged
merged 6 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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