Skip to content

Commit f73252b

Browse files
committed
Install and run some Go linters
1 parent 2bff5d3 commit f73252b

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
docker:
1515
name: 'Run docker image building'
1616
uses: ./.github/workflows/docker.yml
17+
lint:
18+
name: 'Lint all the things!'
19+
uses: ./.github/workflows/lint.yml
1720
test:
1821
name: 'Run tests and linting'
1922
strategy:

.github/workflows/lint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
on:
2+
workflow_call:
3+
4+
jobs:
5+
lint:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: checkout code
9+
uses: actions/checkout@v4
10+
11+
- name: Set up Go
12+
uses: actions/setup-go@v5
13+
with:
14+
go-version: '1.21'
15+
16+
- name: Install ack
17+
run: sudo apt-get update && sudo apt-get install -y ack-grep
18+
shell: bash # Explicitly use Bash because otherwise failing Windows jobs are not erroring.
19+
20+
- name: Install testing linting
21+
run: make install-tools-linting
22+
shell: bash # Explicitly use Bash because otherwise failing Windows jobs are not erroring.
23+
24+
- name: Lint
25+
run: make lint
26+
shell: bash # Explicitly use Bash because otherwise failing Windows jobs are not erroring.

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,19 @@ install: # [Go package] - # Build and install everything, or only the specified
4747
go install -v -ldflags="$(GO_LDFLAGS)" $(PACKAGE)
4848
.PHONY: install
4949

50-
install-all: install install-tools install-tools-testing # Install everything for and of this repository.
50+
install-all: install install-tools install-tools-linting install-tools-testing # Install everything for and of this repository.
5151
.PHONY: install-all
5252

5353
install-tools: # Install tools that are required for running the evaluation.
5454
eval-dev-quality install-tools $(if $(ARGS), --install-tools-path $(word 1,$(ARGS)))
5555
.PHONY: install-tools
5656

57+
install-tools-linting: # Install tools that are used for linting.
58+
go install -v github.com/kisielk/[email protected]
59+
go install -v github.com/mgechev/[email protected]
60+
go install -v honnef.co/go/tools/cmd/[email protected]
61+
.PHONY: install-tools-linting
62+
5763
install-tools-testing: # Install tools that are used for testing.
5864
go install -v github.com/vektra/mockery/[email protected]
5965
go install -v gotest.tools/[email protected]
@@ -63,6 +69,13 @@ generate: # Run code generation.
6369
mockery
6470
.PHONY: generate
6571

72+
lint: # Check repository.
73+
errcheck ./...
74+
go vet ./...
75+
revive ./... | ack -v "(should have a package comment|seems to be unused, consider removing or renaming it)" || true
76+
staticcheck ./...
77+
.PHONY: lint
78+
6679
lint-build-ci: generate # Check artifacts.
6780
make require-clean-worktree
6881
.PHONY: lint-build-ci

0 commit comments

Comments
 (0)