Skip to content

Conversation

@alexandear
Copy link
Contributor

Summary

Refactor the codebase to utilize the latest practices and Go language features. This was found with the help of modernize and intrange linters.

Why

Improves code quality and maintainability by modernizing Go code patterns to use current best practices and language features.

What changed

  • Added modernize and intrange linters to .golangci.yml.
  • Changed Golangci-lint version from v2.5 to v2.8 in .github/workflows/lint.yml and script/lint. This is required because the modernize linter was added in v2.6.
  • Applied modernize and intrange linter suggestions (via golangci-lint run --fix) with some manual editing.
  • Excluded "revive var-naming: avoid package names that conflict with Go standard library package names" issue. Because it complains about the context, errors, and http packages.

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
  • New tool added

Prompts tested (tool changes only)

  • N/A

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

Copilot AI review requested due to automatic review settings February 10, 2026 10:45
@alexandear alexandear requested a review from a team as a code owner February 10, 2026 10:45
Copy link
Contributor

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

Modernizes the Go codebase based on modernize and intrange golangci-lint suggestions, and updates lint tooling to support these linters.

Changes:

  • Enabled modernize and intrange in .golangci.yml and updated golangci-lint versions in CI and script/lint.
  • Refactored code to use newer Go stdlib helpers (slices, maps, strings.CutSuffix, min/max, any) and for range <int> loops.
  • Updated tests and supporting utilities to align with the modernized patterns (primarily interface{}any and 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.

@alexandear
Copy link
Contributor Author

I know it's a lot of changes. But they are trivial and can be easily applied via ./bin/golangci-lint run --fix

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.

1 participant