lint: align local gofumpt rules with golangci-lint v2.5.0
CI / Test (linux/amd64) (pull_request) Successful in 21s
CI / Lint (pull_request) Successful in 24s
CI / Build (windows/amd64) (pull_request) Successful in 20s
CI / Build (linux/amd64) (pull_request) Successful in 21s
CI / Build (linux/arm64) (pull_request) Successful in 20s

Bumping CI to v2.5.0 surfaced two new gofumpt findings (in two test
files that gofumpt v2.1.6 considered fine). Local re-format with
the matching tool brings them in line.

Pre-commit hook config: prepend $GOPATH/bin to PATH inside the hook
entry so gofumpt + golangci-lint resolve when ~/go/bin isn't on the
operator's interactive shell PATH (common — go install puts them
there but PATH config varies). Without this, the hooks fail with
'Executable not found' even when the tools are installed.

Pin the Makefile setup target to v2.5.0 so a fresh clone gets the
same binary CI runs — keeps pre-commit and CI from drifting again.
This commit is contained in:
2026-05-03 21:31:47 +01:00
parent 694d9d9bf3
commit dd7b37a5c1
4 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -26,7 +26,7 @@ repos:
- id: gofumpt
name: gofumpt
description: Format Go files with gofumpt (stricter superset of gofmt)
entry: gofumpt -l -w
entry: bash -c 'PATH="$(go env GOPATH)/bin:$PATH" exec gofumpt -l -w "$@"' --
language: system
types: [go]
pass_filenames: true
@@ -42,7 +42,7 @@ repos:
- id: golangci-lint
name: golangci-lint
description: Run golangci-lint against the whole module (matches CI)
entry: golangci-lint run ./...
entry: bash -c 'PATH="$(go env GOPATH)/bin:$PATH" exec golangci-lint run ./...'
language: system
types: [go]
pass_filenames: false
+1 -1
View File
@@ -60,7 +60,7 @@ lint: ## Run golangci-lint
setup: hooks ## One-time per-clone setup (Go tools + git hooks)
@command -v gofumpt >/dev/null 2>&1 || go install mvdan.cc/gofumpt@latest
@command -v golangci-lint >/dev/null 2>&1 || go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
@command -v golangci-lint >/dev/null 2>&1 || go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.5.0
@echo "==> setup complete: gofumpt, golangci-lint, pre-commit hooks installed"
hooks: ## Install the pre-commit hooks defined in .pre-commit-config.yaml
+1 -1
View File
@@ -102,7 +102,7 @@ func enrolHostForWS(t *testing.T, srv *Server, st *store.Store, name string) (ho
if err := st.SetHostCredentials(context.Background(), hostID, enc); err != nil {
t.Fatalf("set creds: %v", err)
}
return
return hostID, token
}
func sendHello(t *testing.T, c *websocket.Conn, hostname string) {
+1 -1
View File
@@ -47,7 +47,7 @@ func setupTestHub(t *testing.T) (url string, token string, hostID string, st *st
t.Fatalf("enroll: %v", err)
}
url = "ws" + strings.TrimPrefix(srv.URL, "http") + "/ws/agent"
return
return url, token, hostID, st, hub
}
func TestWSHelloAndHeartbeat(t *testing.T) {