Skip to content

Go: Fix err instead of decErr in GetPkgsInfo #19249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged

Conversation

mbg
Copy link
Member

@mbg mbg commented Apr 8, 2025

Seems like err was used incorrectly instead of decErr here. The Go compiler alerted me to this, since err is nil at this point.

@Copilot Copilot AI review requested due to automatic review settings April 8, 2025 11:06
@mbg mbg requested a review from a team as a code owner April 8, 2025 11:06
@github-actions github-actions bot added the Go label Apr 8, 2025
Copy link
Contributor

@Copilot 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

This PR fixes a bug in the GetPkgsInfo function where the wrong error variable was used in the logging statement, potentially masking the underlying issue.

  • Corrects the logging message by replacing err with decErr.

@@ -259,7 +259,7 @@ func GetPkgsInfo(patterns []string, includingDeps bool, extractTests bool, flags
break
}
if decErr != nil {
log.Printf("Error decoding output of go list -json: %s", err.Error())
log.Printf("Error decoding output of go list -json: %s", decErr.Error())
Copy link
Preview

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

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

This change corrects the error logging by using decErr instead of err, ensuring that the actual decoding error is logged.

Copilot uses AI. Check for mistakes.

@mbg mbg merged commit 87f2ccb into main Apr 8, 2025
13 checks passed
@mbg mbg deleted the mbg/go/fix-getpkginfo-decerr branch April 8, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants