Skip to content

Modernize Go code - #642

Merged
jeffwidman merged 1 commit into
mainfrom
copilot/go-modernize
Aug 8, 2026
Merged

Modernize Go code#642
jeffwidman merged 1 commit into
mainfrom
copilot/go-modernize

Conversation

@jeffwidman

Copy link
Copy Markdown
Member

Summary

  • apply the Go modernize analyzer across production and test packages
  • use modern standard-library helpers such as maps.Copy, strings.Cut, and strings.CutPrefix
  • adopt integer ranges and any, and remove ineffective JSON omitempty options from struct-valued fields

Review notes

The generated changes were reviewed for behavior differences. In particular, removing JSON omitempty from VersionManager fields does not change serialization because encoding/json does not consider non-pointer structs empty. The analyzer skipped omitzero alternatives that it identified as possible behavior changes.

Validation

  • go test -timeout=2m ./cmd/dependabot/internal/cmd ./internal/infra ./internal/model ./internal/server
  • go vet ./...
  • go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest ./...
  • go test -shuffle=on -count=2 -race -cover -timeout=5m ./... passed all four code packages, but the Docker-backed cmd/dependabot script suite exceeded its five-minute package timeout while building and running test containers

@jeffwidman
jeffwidman marked this pull request as ready for review August 6, 2026 21:29
@jeffwidman
jeffwidman requested review from a team as code owners August 6, 2026 21:29
@jeffwidman
jeffwidman requested a balanced review from Copilot August 6, 2026 21:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Modernizes Go syntax and standard-library usage without changing behavior.

Changes:

  • Uses any and integer ranges.
  • Replaces manual operations with maps.Copy, strings.Cut, and strings.CutPrefix.
  • Removes ineffective JSON omitempty tags from struct fields.
Show a summary per file
File Description
internal/model/update.go Corrects JSON tags for struct-valued fields.
internal/model/job.go Replaces interface{} with any.
internal/model/job_test.go Modernizes test helper syntax.
internal/infra/tty.go Uses an integer range for retries.
internal/infra/run.go Uses modern map and string helpers.
internal/infra/proxy_test.go Uses strings.CutPrefix.
cmd/dependabot/internal/cmd/update_test.go Modernizes the retry loop.

Review details

  • Files reviewed: 7/7 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@jeffwidman
jeffwidman enabled auto-merge August 7, 2026 04:07
@jeffwidman
jeffwidman force-pushed the copilot/go-modernize branch from d0458b3 to f0f178d Compare August 7, 2026 04:32
go func() {
// Retry the calls in case the server takes a bit to start up.
for i := 0; i < 10; i++ {
for range 10 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice

@jeffwidman
jeffwidman added this pull request to the merge queue Aug 8, 2026
Merged via the queue into main with commit 42310a8 Aug 8, 2026
107 checks passed
@jeffwidman
jeffwidman deleted the copilot/go-modernize branch August 8, 2026 00:14
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.

3 participants