Modernize Go code - #642
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Modernizes Go syntax and standard-library usage without changing behavior.
Changes:
- Uses
anyand integer ranges. - Replaces manual operations with
maps.Copy,strings.Cut, andstrings.CutPrefix. - Removes ineffective JSON
omitemptytags 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
enabled auto-merge
August 7, 2026 04:07
jeffwidman
force-pushed
the
copilot/go-modernize
branch
from
August 7, 2026 04:32
d0458b3 to
f0f178d
Compare
honeyankit
approved these changes
Aug 8, 2026
| go func() { | ||
| // Retry the calls in case the server takes a bit to start up. | ||
| for i := 0; i < 10; i++ { | ||
| for range 10 { |
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
modernizeanalyzer across production and test packagesmaps.Copy,strings.Cut, andstrings.CutPrefixany, and remove ineffective JSONomitemptyoptions from struct-valued fieldsReview notes
The generated changes were reviewed for behavior differences. In particular, removing JSON
omitemptyfromVersionManagerfields does not change serialization becauseencoding/jsondoes not consider non-pointer structs empty. The analyzer skippedomitzeroalternatives that it identified as possible behavior changes.Validation
go test -timeout=2m ./cmd/dependabot/internal/cmd ./internal/infra ./internal/model ./internal/servergo 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-backedcmd/dependabotscript suite exceeded its five-minute package timeout while building and running test containers