8ea27781987db6d47535a87d351297a3ca8321ec

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Fix golangci-lint setup and tests in CI

Diff

 1diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
 2index 720a0a6dc21adfbb3074893d6c343c40cc1f55be..02047a65b03b30356365acf2451db6ac49000f14 100644
 3--- a/.github/workflows/ci.yaml
 4+++ b/.github/workflows/ci.yaml
 5@@ -22,8 +22,6 @@ jobs:
 6           --health-interval 5s
 7           --health-timeout 2s
 8           --health-retries 5
 9-        ports:
10-          - 5432:5432
11 
12     steps:
13       - uses: actions/checkout@v6
14@@ -37,17 +35,20 @@ jobs:
15       - name: go vet
16         run: go vet ./...
17 
18+      - name: Read golangci-lint version
19+        run: echo "GOLANGCI_LINT_VERSION=$(cat .golangci-lint-version)" >> "$GITHUB_ENV"
20+
21       - name: golangci-lint
22         uses: golangci/golangci-lint-action@v9
23         with:
24-          version: v2.11.4
25+          version: ${{ env.GOLANGCI_LINT_VERSION }}
26 
27       - name: govulncheck
28         run: make govulncheck
29 
30       - name: Tests
31         env:
32-          DB_URI: postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable
33+          DB_URI: postgresql://postgres:postgres@postgres:5432/postgres?sslmode=disable
34         run: |-
35           make migrate
36           make test
37diff --git a/.golangci-lint-version b/.golangci-lint-version
38new file mode 100644
39index 0000000000000000000000000000000000000000..9b78e863e6c762f8da51c15a85d44d954053e6d3
40--- /dev/null
41+++ b/.golangci-lint-version
42@@ -0,0 +1 @@
43+v2.13.1
44diff --git a/Makefile b/Makefile
45index e80bcd7a39310a03176e1360b4ef114c3fa8b652..9c83c634b51810b35bf6aaf7076971a45fba381b 100644
46--- a/Makefile
47+++ b/Makefile
48@@ -6,8 +6,8 @@ bin:
49 	mkdir bin
50 bin/moq: bin
51 	GOBIN=$(PWD)/bin go install github.com/matryer/moq@v0.7.1
52-bin/golangci-lint: bin
53-	GOBIN=$(PWD)/bin go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.1
54+bin/golangci-lint: .golangci-lint-version | bin
55+	GOBIN=$(PWD)/bin go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$$(cat .golangci-lint-version)
56 bin/migrate: bin
57 	GOBIN=$(PWD)/bin go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@v4.19.1
58 bin/air: bin