Clean up the ST1003 and QF1008 findings that golangci-lint v2 surfaced

Open Beginner friendly
#573 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go

Research direction

Start in pkg/infrastructure/kubernetes/unleash_repository.go and review all ST1003 initialism and QF1008 selector findings reported by golangci-lint. After the reconciler stack has landed, update the affected names and selectors, remove both exclusions from .golangci.yml, and run mise run lint and mise run check until they are clean.

Written by the indexing model from the issue text.

Description

enhancement go

Summary

#572 upgrades golangci-lint to v2, which folds stylecheck into staticcheck and therefore surfaces the ST checks for the first time. It reported 18 pre-existing findings. They are excluded in .golangci.yml for now so the upgrade lands without mixing in unrelated code changes, but they are worth fixing.

Severity: low — style only, no behaviour change
Component: mostly pkg/infrastructure/kubernetes/unleash_repository.go

Findings

14 × ST1003 — initialisms should be capitalised:

unleash_repository.go:593  var   cloudSqlProto         → cloudSQLProto
unleash_repository.go:594  var   cloudSqlPort          → cloudSQLPort
unleash_repository.go:607  const SqlProxyRequestCPU    → SQLProxyRequestCPU
unleash_repository.go:608  const SqlProxyRequestMemory → SQLProxyRequestMemory
unleash_repository.go:609  const SqlProxyLimitMemory   → SQLProxyLimitMemory

…and the rest in the same file.

4 × QF1008 — redundant embedded field in selector, e.g. unleashNew.ObjectMeta.Generation can be written unleashNew.Generation.

Why not in #572

These all live in unleash_repository.go, which the reconciler stack (#549, #550, #551) also modifies. Renaming symbols there while those PRs are open would create rebase conflicts for no benefit. Best done once that stack has landed.

Acceptance criteria

  • ST1003 and QF1008 findings fixed.
  • The -ST1003 and -QF1008 exclusions removed from .golangci.yml.
  • mise run lint and mise run check both clean.
Dominant language
Go
Stars
0
Forks
0
Avg merge
7h 56m
Merged PRs (30d)
24

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nais/bifrost

All issues in nais/bifrost

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.