Skip to content

Update golangci-lint to v2.7.2 and migrate configuration#7386

Merged
pelikhan merged 6 commits intomainfrom
copilot/update-golangci-lint-version
Dec 23, 2025
Merged

Update golangci-lint to v2.7.2 and migrate configuration#7386
pelikhan merged 6 commits intomainfrom
copilot/update-golangci-lint-version

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 23, 2025

Update golangci-lint to v2.7.2

  • Update golangci-lint dependency in go.mod from v1.62.2 to v2.7.2
  • Update tools.go to import v2 module path
  • Run go mod tidy to update go.sum
  • Run go mod download to fetch the new version
  • Verify the installation by checking version
  • Run make deps to ensure no dependency conflicts
  • Migrate configuration file to v2 format using migration tool
  • Verify linter works with new configuration
  • Apply golangci-lint v2 auto-fixes and manual corrections
  • Fix bundler indentation bug from switch conversion
  • Validate all formatting and linting checks pass
  • Verify all tests pass
Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Update golangci-lint dependency to v2.7.2</issue_title>
<issue_description>## Objective

Update the golangci-lint dependency from v1.62.2 to v2.7.2 in the project's dependency management files.

Context

This is the first step in the golangci-lint v2 upgrade. We need to update the dependency declaration before running the migration tool.

Approach

  1. Update go.mod with the new version
  2. Update tools.go import statement
  3. Run go mod tidy to update go.sum
  4. Run go mod download to fetch the new version
  5. Verify the installation

Files to Modify

  • go.mod - Update golangci-lint version to v2.7.2
  • tools.go - Verify import statement (likely no change needed)
  • go.sum - Will be updated automatically by go mod tidy

Commands

# Update to v2.7.2
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v2.7.2

# Clean up dependencies
go mod tidy

# Verify installation
go run github.com/golangci/golangci-lint/cmd/golangci-lint version

Acceptance Criteria

  • go.mod shows golangci-lint v2.7.2
  • go.sum contains v2.7.2 checksums
  • golangci-lint version command shows v2.7.2
  • No dependency conflicts in go.mod
  • make deps completes successfully

Notes

This task only updates the dependency. The configuration migration happens in the next task.
Related to #7375

AI generated by Plan Command for discussion #7356

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 23, 2025 11:57
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Update golangci-lint dependency to v2.7.2 Update golangci-lint to v2.7.2 Dec 23, 2025
Copilot AI requested a review from mnkiefer December 23, 2025 12:07
@pelikhan
Copy link
Copy Markdown
Collaborator

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 23, 2025

@copilot update configuration see https://github.com/githubnext/gh-aw/actions/runs/20460163097/job/58791308416#step:7:1

Configuration migrated to v2 format using the migration tool. The changes include:

  • Added version: "2" at the top of the configuration
  • Removed run.timeout (disabled by default in v2)
  • Restructured linters settings into linters.settings section
  • Moved issue exclusions to linters.exclusions section
  • Created new formatters section for gofmt and goimports

All originally enabled linters (errcheck, govet, ineffassign, misspell, revive, staticcheck, unused) are still active and the linter now works successfully.

Commit: 92dc6ac

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • golangci-lint.run
    • Triggering command: /home/REDACTED/.cache/go-build/07/07deb89b46a2a83f9dcab7b557d9bac04c3b7da0b7f9ac82acec4973fe791740-d/golangci-lint /home/REDACTED/.cache/go-build/07/07deb89b46a2a83f9dcab7b557d9bac04c3b7da0b7f9ac82acec4973fe791740-d/golangci-lint migrate (dns block)
    • Triggering command: /home/REDACTED/.cache/go-build/07/07deb89b46a2a83f9dcab7b557d9bac04c3b7da0b7f9ac82acec4973fe791740-d/golangci-lint /home/REDACTED/.cache/go-build/07/07deb89b46a2a83f9dcab7b557d9bac04c3b7da0b7f9ac82acec4973fe791740-d/golangci-lint config verify GOPROXY GOROOT GOSUMDB GOWORK 64/bin/go (dns block)
  • https://api.github.com/repos/githubnext/gh-aw/actions/runs/20460163097/jobs
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Update golangci-lint to v2.7.2 Update golangci-lint to v2.7.2 and migrate configuration Dec 23, 2025
Copilot AI requested a review from pelikhan December 23, 2025 12:25
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot format and lint

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 23, 2025

@copilot format and lint

Formatting and linting complete. Applied golangci-lint v2 auto-fixes and manual corrections to 63 files:

  • Used --fix flag to automatically fix quickfix suggestions
  • Manually applied De Morgan's law transformations to 6 files for hex validation logic
  • Fixed error string capitalization in bundler_validation.go
  • All linting checks now pass with 0 issues

Commit: a7bc3ba

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot fix compilation, run tests and fix code

The automatic conversion of if-else to switch statement introduced a bug
in the getIndentation function. In a switch statement, 'break' only breaks
out of the switch, not the outer for loop. Reverted to if-else with
nolint comment explaining why switch is not appropriate here.

Fixes test failures in TestOnSectionWithQuotes and related tests.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 23, 2025

@copilot fix compilation, run tests and fix code

Fixed compilation and test issues. The problem was an incorrect if-else to switch conversion in the bundler code that changed the behavior of break (switch break vs loop break).

  • ✅ All tests now pass (including previously failing TestOnSectionWithQuotes, TestStopAfterCompiledAway, etc.)
  • ✅ Build successful
  • ✅ Linting passes with 0 issues
  • ✅ Code properly formatted

The issue was that golangci-lint's auto-fix suggested using a switch statement, but in this specific case the break keyword needs to break out of the for loop, not just the switch. Reverted to if-else with a nolint comment explaining the reasoning.

Commit: f5a4e57

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login -bun.git -buildtags (http block)
    • Triggering command: /usr/bin/gh gh api user --jq .login ithub/workflows -buildtags 0/x64/bin/node l -ifaceassert -nilfunc git ortc�� 64/create_pr_review_comment.js stmain.go /usr/bin/git /gh-aw (http block)
    • Triggering command: /usr/bin/gh gh api user --jq .login ithub/workflows version /home/REDACTED/.cache/go-build/e9/e9aaf1bd0fbb03c5e5bed2066eaa1bef3cbf471b2a7666474e187f2b85438c15&#34;mcp-server-playwright&#34; --help (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@pelikhan pelikhan marked this pull request as ready for review December 23, 2025 15:01
@pelikhan pelikhan merged commit 448359f into main Dec 23, 2025
84 checks passed
@pelikhan pelikhan deleted the copilot/update-golangci-lint-version branch December 23, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Update golangci-lint dependency to v2.7.2

3 participants