Skip to content

fix(lint): extract repeated strings as constants to satisfy goconst#51

Open
uwe-mayer wants to merge 2 commits into
mainfrom
fix/goconst-lint-errors
Open

fix(lint): extract repeated strings as constants to satisfy goconst#51
uwe-mayer wants to merge 2 commits into
mainfrom
fix/goconst-lint-errors

Conversation

@uwe-mayer
Copy link
Copy Markdown
Contributor

Summary

Fixes goconst lint errors by extracting repeated string literals as constants:

  • controller/careinstruction/metrics.go: Extract metric label keys (care_instruction, namespace, garden_namespace, shoot_name) as package-level constants
  • controller/shoot/auth.go: Extract "config.yaml" ConfigMap data key as a constant

These were flagged by the updated golangci-lint goconst rule.

Signed-off-by: uwe-mayer <uwe.mayer01@sap.com>
Copilot AI review requested due to automatic review settings May 8, 2026 11:43
@uwe-mayer uwe-mayer requested a review from a team as a code owner May 8, 2026 11:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses new golangci-lint goconst findings by replacing repeated string literals with package-level constants, keeping behavior unchanged while reducing lint noise.

Changes:

  • Extracted Prometheus metric label keys into constants in the CareInstruction metrics package.
  • Extracted the ConfigMap.Data key "config.yaml" into a constant in Shoot OIDC/auth configuration code.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
controller/shoot/auth.go Replaces repeated "config.yaml" ConfigMap data key usages with a single package constant.
controller/careinstruction/metrics.go Replaces repeated metric label key strings with package-level constants for Prometheus label definitions/usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/cloudoperators/shoot-grafter/controller/careinstruction 0.00% (ø)
github.com/cloudoperators/shoot-grafter/controller/shoot 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/cloudoperators/shoot-grafter/controller/careinstruction/metrics.go 0.00% (ø) 0 0 0
github.com/cloudoperators/shoot-grafter/controller/shoot/auth.go 0.00% (ø) 0 0 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Signed-off-by: uwe-mayer <uwe.mayer01@sap.com>
@uwe-mayer uwe-mayer force-pushed the fix/goconst-lint-errors branch from 11fcf7e to 41e3ffc Compare May 11, 2026 13:17
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