fix(cmd/gf): fix gf env and gf build --dumpEnv command error#4635
Merged
gqcn merged 1 commit intogogf:masterfrom Jan 21, 2026
Merged
fix(cmd/gf): fix gf env and gf build --dumpEnv command error#4635gqcn merged 1 commit intogogf:masterfrom
gqcn merged 1 commit intogogf:masterfrom
Conversation
d4c6b26 to
c26cf56
Compare
When go env outputs warning messages (e.g., "go: stripping unprintable characters from GOPROXY") and returns non-zero exit code, the gf env command would fail. Changes: - Only fail when go env returns empty output, allow non-zero exit code with valid output - Skip lines that don't match key=value format instead of failing - Add debug log for skipped lines - Add unit tests for env command
e97712c to
031914d
Compare
gqcn
approved these changes
Jan 21, 2026
Member
|
/lgtm |
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
gf envandgf build --dumpEnvcommand failing whengo envoutputs warning messagesgo envoutputs warnings (e.g., invalid characters in environment variables), it returns non-zero exit code but still provides valid outputChanges
go envreturns empty output, allow non-zero exit code with valid outputkey=valueformat instead of failing with Fatal errorRelated Issue
Fixes #4469
Test plan
gf envcommand works correctly even whengo envoutputs warningsgf build --dumpEnvworks correctly