fix(ci): don't capture tool-download noise as a formatting diff

The gofumpt check merged stderr into the diff variable, so 'go:
downloading ...' lines made it always fail. Move tool installation into
its own step (adding GOPATH/bin to PATH) and capture only stdout.
This commit is contained in:
2026-09-03 21:33:12 +02:00
parent 4d4bc09b86
commit 77e6e72f5a
2 changed files with 11 additions and 4 deletions
+10 -3
View File
@@ -23,9 +23,16 @@ jobs:
- name: go vet - name: go vet
run: go vet ./... run: go vet ./...
- name: Install lint tools
run: |
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
go install golang.org/x/vuln/cmd/govulncheck@latest
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
- name: gofumpt (golangci-lint fmt) - name: gofumpt (golangci-lint fmt)
run: | run: |
diff=$(go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest fmt --diff 2>&1) diff=$(golangci-lint fmt --diff)
if [ -n "$diff" ]; then if [ -n "$diff" ]; then
echo "$diff" echo "$diff"
echo "Formatting issues found. Run: make fmt" echo "Formatting issues found. Run: make fmt"
@@ -33,10 +40,10 @@ jobs:
fi fi
- name: staticcheck - name: staticcheck
run: go run honnef.co/go/tools/cmd/staticcheck@latest ./... run: staticcheck ./...
- name: govulncheck - name: govulncheck
run: go run golang.org/x/vuln/cmd/govulncheck@latest ./... run: govulncheck ./...
- name: Test - name: Test
run: go test ./... run: go test ./...
+1 -1
View File
@@ -58,7 +58,7 @@ fmt: ## Format code (gofumpt + goimports via golangci-lint)
fmt-check: ## Check formatting (gofumpt + goimports via golangci-lint) fmt-check: ## Check formatting (gofumpt + goimports via golangci-lint)
@echo "Checking formatting..." @echo "Checking formatting..."
@diff=$$($(GOLANGCI_LINT) fmt --diff --config=.golangci.json 2>&1); \ @diff=$$($(GOLANGCI_LINT) fmt --diff --config=.golangci.json); \
if [ -n "$$diff" ]; then echo "$$diff"; echo "Run: make fmt"; exit 1; fi if [ -n "$$diff" ]; then echo "$$diff"; echo "Run: make fmt"; exit 1; fi
staticcheck: ## Run staticcheck staticcheck: ## Run staticcheck