Skip to content

Commit 048f132

Browse files
authored
Add golangci-lint as a dependency (#176)
1 parent 872bc51 commit 048f132

File tree

6 files changed

+1047
-17
lines changed

6 files changed

+1047
-17
lines changed

.github/workflows/lint.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ defaults:
1717
shell: bash
1818

1919
env:
20-
GOLANGCI_VERSION: 1.38
2120
GOLANGCI_TIMEOUT: 10m0s
2221

2322
jobs:
@@ -31,5 +30,4 @@ jobs:
3130
- name: Lint Code
3231
uses: golangci/[email protected]
3332
with:
34-
version: 'v${{ env.GOLANGCI_VERSION }}'
3533
args: --timeout ${{ env.GOLANGCI_TIMEOUT }} --issues-exit-code=0

.golangci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
linters-settings:
2+
misspell:
3+
locale: US
4+
5+
linters:
6+
enable:
7+
- goimports
8+
- gosimple
9+
- govet
10+
- misspell
11+
- gofmt
12+
- unparam
13+
- unconvert
14+
- structcheck
15+
- errcheck
16+
disable-all: true
17+

Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ DOCKERFILEPATH = build
66
DOCKERFILE = Dockerfile
77

88
GIT_COMMIT = $(shell git rev-parse HEAD)
9-
10-
GOLANGCI_CONTAINER=golangci/golangci-lint:v1.29-alpine
119
DATE = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
1210

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

1917
.PHONY: lint
2018
lint:
21-
docker run --rm \
22-
-v $(shell pwd):/go/src/github.com/nginxinc/nginx-prometheus-exporter \
23-
-w /go/src/github.com/nginxinc/nginx-prometheus-exporter \
24-
$(GOLANGCI_CONTAINER) golangci-lint run
19+
go run github.com/golangci/golangci-lint/cmd/golangci-lint run
2520

2621
.PHONY: test
2722
test:
@@ -35,6 +30,10 @@ container:
3530
push: container
3631
docker push $(PREFIX):$(TAG)
3732

33+
.PHONY: deps
34+
deps:
35+
@go mod tidy && go mod verify && go mod download
36+
3837
.PHONY: clean
3938
clean:
4039
-rm -r dist

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module github.com/nginxinc/nginx-prometheus-exporter
33
go 1.16
44

55
require (
6+
github.com/golangci/golangci-lint v1.39.0
67
github.com/nginxinc/nginx-plus-go-client v0.8.0
78
github.com/prometheus/client_golang v1.10.0
89
github.com/prometheus/common v0.20.0
9-
google.golang.org/protobuf v1.26.0 // indirect
1010
)

0 commit comments

Comments
 (0)