Fix goconst lint errors after golangci-lint v2.12 update#97
Merged
Conversation
The latest golangci-lint (v2.12.x) detects more repeated string literals in the goconst linter, surfacing 95 issues across the codebase that were previously not flagged. Extract repeated literals into named constants: - Production code (`oci/skills`, `container/verifier`, `registry/converters`): hoist shared OCI media types, architecture names, default version/status, and the SKILL.md filename into package-level constants. A few are exported where they have semantic meaning to callers (e.g. MediaTypeOCIEmptyV1JSON, ArchAMD64, SkillFileName). - Test files (`cel`, `permissions`, `registry/types`, `registry/converters`, `oci/skills`, `validation/http`): introduce unexported package-level test constants for repeated literals (test-case names, fixture values, expected error substrings, fixture paths). Where it kept things tidy, constants live in a dedicated `*_test.go` file shared across the package. No behavior changes — `task lint` reports 0 issues and the full test suite passes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
9566497 to
0aec520
Compare
rdimitrov
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
golangci-lint(v2.12.x) detects more repeated string literals in thegoconstlinter, surfacing 95 new issues across the codebase. This was visible on PR Update module github.com/mark3labs/mcp-go to v0.51.0 #96 (a Renovate dependency bump) where lint failed despite no code changes from the PR.MediaTypeOCIEmptyV1JSON,ArchAMD64,SkillFileName), test files use unexported package-level test constants.task lintis clean and the full test suite passes.Affected packages
celcontainer/verifierutils.gooci/skillsOSLinux,ArchAMD64,ArchARM64,SkillFileName; addedtestconsts_test.gopermissionsregistry/converterstoolhive_to_upstream.go; addedtestconst_test.goregistry/typestest_constants_test.govalidation/httpTest plan
task lintpasses with 0 issuestask testpasses (all packages green)task license-checkpasses for the new files🤖 Generated with Claude Code