Skip to content

fix(lint): resolve goconst violations across packages#280

Merged
dcmcand merged 2 commits intomainfrom
fix/golangci-lint-goconst
May 6, 2026
Merged

fix(lint): resolve goconst violations across packages#280
dcmcand merged 2 commits intomainfrom
fix/golangci-lint-goconst

Conversation

@dcmcand
Copy link
Copy Markdown
Contributor

@dcmcand dcmcand commented May 5, 2026

Summary

CI's golangci-lint job has been failing on main since the goconst rules tightened in golangci-lint v2.12.1. This PR clears all 39 goconst issues so CI goes green.

  • .golangci.yml: bump goconst.min-occurrences from the default 3 to 4, and add ignore-string-values: ^(true|false|Config|name)$. Together these skip strings that are too incidental or too generic to meaningfully name as constants.
  • Code: extract named constants for the meaningful repeats: Argo CD chart version and namespace, the argocd-server deployment name, the local-gitops volume name, the AWS IAM Authenticator kubeconfig exec args (eks, get-token, --cluster-name, --region, client.authentication.k8s.io/v1beta1), Longhorn webhook security-group keys and node label, the 0.0.0.0/0 default CIDR allowlist, and the local provider's standard StorageClass and MetalLB address pool defaults.
  • Reuse the existing aws.ProviderName for the kubeconfig exec command; add a matching local.ProviderName.

The lint failures are pre-existing on main (not introduced by any open PR), so this lands as a standalone fix.

Test plan

  • golangci-lint run reports 0 issues locally (v2.12.1)
  • go build ./... succeeds
  • go test ./... passes
  • CI passes on this PR

Tune goconst to skip generic noise strings (true/false/Config/name) and
bump min-occurrences to 4 so only repeats that clearly warrant a constant
get flagged. Extract named constants for the meaningful repeats: Argo CD
chart version and namespace, deployment names, kubeconfig exec args, the
local-gitops volume name, longhorn webhook keys and node label, the
default CIDR allowlist, and K3s defaults. Reuse the existing aws.ProviderName
constant; add a parallel local.ProviderName.
CI's config verify rejects the regex string form; the schema requires an
array of literal strings.
Copy link
Copy Markdown
Member

@marcelovilla marcelovilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @dcmcand! Thanks for taking care of this

@dcmcand dcmcand merged commit 4481d70 into main May 6, 2026
2 checks passed
@dcmcand dcmcand deleted the fix/golangci-lint-goconst branch May 6, 2026 10:11
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.

2 participants