refactor: modernize code with modernize and intrange linters#1988
Merged
SamMorrowDrums merged 2 commits intogithub:mainfrom Feb 12, 2026
Merged
refactor: modernize code with modernize and intrange linters#1988SamMorrowDrums merged 2 commits intogithub:mainfrom
modernize and intrange linters#1988SamMorrowDrums merged 2 commits intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Modernizes the Go codebase based on modernize and intrange golangci-lint suggestions, and updates lint tooling to support these linters.
Changes:
- Enabled
modernizeandintrangein.golangci.ymland updated golangci-lint versions in CI andscript/lint. - Refactored code to use newer Go stdlib helpers (
slices,maps,strings.CutSuffix,min/max,any) andfor range <int>loops. - Updated tests and supporting utilities to align with the modernized patterns (primarily
interface{}→anyand slice/map helpers).
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| script/lint | Bumps locally-installed golangci-lint version to v2.8.0. |
| .github/workflows/lint.yml | Updates CI golangci-lint version configuration to v2.8. |
| .golangci.yml | Enables modernize + intrange and adds an exclusion rule for revive’s stdlib-name conflict warning. |
| pkg/tooldiscovery/search.go | Uses max() for simpler max-length calculation in similarity scoring. |
| pkg/scopes/scopes.go | Uses slices.Sort for deterministic scope ordering. |
| pkg/raw/raw.go | Switches request body type to any. |
| pkg/lockdown/lockdown.go | Switches GraphQL variables map type to map[string]any. |
| pkg/inventory/filters.go | Uses slices.Sort for enabled toolset ID ordering. |
| pkg/inventory/builder.go | Uses maps.Copy and slices.Sort for simpler map copy and deterministic ordering. |
| pkg/http/oauth/oauth.go | Uses strings.CutSuffix for cleaner route joining. |
| pkg/github/tools.go | Replaces manual loop with slices.Contains. |
| pkg/github/repositories.go | Updates request parsing maps/slices to any-based types. |
| pkg/github/pullrequests.go | Switches GraphQL variables map type to map[string]any. |
| pkg/github/issues.go | Switches GraphQL variables/response maps to map[string]any. |
| pkg/github/discussions.go | Switches GraphQL variables/response maps to map[string]any. |
| pkg/github/context_tools.go | Switches GraphQL variables map type to map[string]any. |
| pkg/github/actions.go | Switches inputs map type to map[string]any and simplifies buffer sizing with min(). |
| pkg/buffer/buffer.go | Simplifies buffer-size math with min() and uses for range <int> iteration. |
| cmd/mcpcurl/main.go | Uses any-typed argument maps and updates JSON parsing containers accordingly. |
| cmd/github-mcp-server/generate_docs.go | Uses slices.Contains and strings.Cut to simplify doc generation logic. |
| internal/toolsnaps/toolsnaps_test.go | Updates test structs/maps to any and uses for range <int> loops. |
| pkg/github/actions_test.go | Updates slices/maps to any and uses for range <int> loops. |
| pkg/github/code_scanning_test.go | Updates request args maps to map[string]any. |
| pkg/github/context_tools_test.go | Updates GraphQL vars/request args maps to map[string]any. |
| pkg/github/dependabot_test.go | Updates request args maps to map[string]any. |
| pkg/github/discussions_test.go | Updates GraphQL vars/request/expected maps to any-based types. |
| pkg/github/gists_test.go | Updates request args maps to map[string]any. |
| pkg/github/git_test.go | Updates request args/response parsing to any-based types. |
| pkg/github/helper_test.go | Updates helper APIs to any and uses for range <int> in path matching. |
| pkg/github/issues_test.go | Updates GraphQL vars/request args maps and arrays to any-based types. |
| pkg/github/notifications_test.go | Updates request args maps to map[string]any. |
| pkg/github/params_test.go | Updates params maps to map[string]any. |
| pkg/github/projects_test.go | Updates request args/response parsing to any-based types. |
| pkg/github/pullrequests_test.go | Updates request args/expected-body maps and arrays to any-based types. |
| pkg/github/repositories_test.go | Updates request args/expected-body maps and arrays to any-based types and uses for range <int>. |
| pkg/github/repository_resource_completions_test.go | Uses for range <int> for deterministic test data generation. |
| pkg/github/search_test.go | Updates request args maps to map[string]any. |
| pkg/github/secret_scanning_test.go | Updates request args maps to map[string]any. |
| pkg/github/security_advisories_test.go | Updates request args maps to map[string]any. |
Contributor
Author
|
I know it's a lot of changes. But they are trivial and can be easily applied via |
JoannaaKL
reviewed
Feb 12, 2026
Contributor
JoannaaKL
left a comment
There was a problem hiding this comment.
Thank you for this pr! Changes look good, please resolve conflicts and I will be happy to stamp
6500b1a to
98f9b97
Compare
98f9b97 to
c795852
Compare
13 tasks
Contributor
Author
@JoannaaKL thank you for the review! I've resolved the conflicts. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
SamMorrowDrums
approved these changes
Feb 12, 2026
Collaborator
SamMorrowDrums
left a comment
There was a problem hiding this comment.
Thank you very much for this!
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
Refactor the codebase to utilize the latest practices and Go language features. This was found with the help of
modernizeandintrangelinters.Why
Improves code quality and maintainability by modernizing Go code patterns to use current best practices and language features.
What changed
modernizeandintrangelinters to.golangci.yml..github/workflows/lint.ymlandscript/lint. This is required because themodernizelinter was added in v2.6.modernizeandintrangelinter suggestions (viagolangci-lint run --fix) with some manual editing.context,errors, andhttppackages.MCP impact
Prompts tested (tool changes only)
Security / limits
Tool renaming
deprecated_tool_aliases.goLint & tests
./script/lint./script/testDocs