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 as a dependency #176

Merged
merged 1 commit into from
Apr 9, 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: 0 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ defaults:
shell: bash

env:
GOLANGCI_VERSION: 1.38
GOLANGCI_TIMEOUT: 10m0s

jobs:
Expand All @@ -31,5 +30,4 @@ jobs:
- name: Lint Code
uses: golangci/golangci-lint-action@v2.5.2
with:
version: 'v${{ env.GOLANGCI_VERSION }}'
args: --timeout ${{ env.GOLANGCI_TIMEOUT }} --issues-exit-code=0
17 changes: 17 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
linters-settings:
misspell:
locale: US

linters:
enable:
- goimports
- gosimple
- govet
- misspell
- gofmt
- unparam
- unconvert
- structcheck
- errcheck
disable-all: true

11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ DOCKERFILEPATH = build
DOCKERFILE = Dockerfile

GIT_COMMIT = $(shell git rev-parse HEAD)

GOLANGCI_CONTAINER=golangci/golangci-lint:v1.29-alpine
DATE = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")

export DOCKER_BUILDKIT = 1
Expand All @@ -18,10 +16,7 @@ nginx-prometheus-exporter:

.PHONY: lint
lint:
docker run --rm \
-v $(shell pwd):/go/src/github.com/nginxinc/nginx-prometheus-exporter \
-w /go/src/github.com/nginxinc/nginx-prometheus-exporter \
$(GOLANGCI_CONTAINER) golangci-lint run
go run github.com/golangci/golangci-lint/cmd/golangci-lint run

.PHONY: test
test:
Expand All @@ -35,6 +30,10 @@ container:
push: container
docker push $(PREFIX):$(TAG)

.PHONY: deps
deps:
@go mod tidy && go mod verify && go mod download

.PHONY: clean
clean:
-rm -r dist
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/nginxinc/nginx-prometheus-exporter
go 1.16

require (
github.com/golangci/golangci-lint v1.39.0
github.com/nginxinc/nginx-plus-go-client v0.8.0
github.com/prometheus/client_golang v1.10.0
github.com/prometheus/common v0.20.0
google.golang.org/protobuf v1.26.0 // indirect
)
Loading