Skip to content

fix: resolve all golangci-lint issues#18

Open
RamazanKara wants to merge 1 commit into
masterfrom
fix/golangci-lint-issues
Open

fix: resolve all golangci-lint issues#18
RamazanKara wants to merge 1 commit into
masterfrom
fix/golangci-lint-issues

Conversation

@RamazanKara
Copy link
Copy Markdown

@RamazanKara RamazanKara commented May 22, 2026

Fixes all issues reported by golangci-lint (verified with v2.12.2 / Go 1.25).

Note: This specific PR was created with support by AI (QWEN-3.6) and verified for functionality and correctness by me.

Changes

File Issue Fix
main.go ST1000: redundant == true bool comparisons Simplified to plain boolean
main.go errcheck: unchecked returns from ExitHandler.Errorf Added _ = assignments
main.go errcheck: unchecked returns from w.Write / fmt.Fprintln Added _, _ = assignments
prometheus.go errcheck: unchecked return from ExitHandler.Set Added _ = assignment
prometheus.go SA1007: strings.Replace with -1 Replaced with strings.ReplaceAll
varnish.go ineffassign: countersJSON assigned but overwritten Changed to var countersJSON map[string]any
varnish.go ST1005: capitalized error strings Lowercased to comply with Go conventions
utils.go unused: endsWith / endsWithAny functions never called Removed both functions
varnish_test.go errcheck: parseVersion return value ignored Added t.Fatal error handling

Verification

$ golangci-lint run ./...
0 issues.

$ go test ./...
ok  	github.com/otto-de/prometheus_varnish_exporter	0.411s

- Remove redundant bool comparisons (ST1000/simplify)
- Use strings.ReplaceAll over strings.Replace with -1 (SA1007/staticcheck)
- Handle unchecked return values from ExitHandler methods and HTTP writers (errcheck)
- Fix ineffectual assignment of countersJSON (ineffassign)
- Lowercase error strings to comply with Go conventions (ST1005/staticcheck)
- Remove unused endsWith and endsWithAny functions (unused)
- Add error handling for VarnishVersion.parseVersion calls in tests (errcheck)
@RamazanKara RamazanKara requested a review from a team as a code owner May 22, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant