fix(ping): correct flag default and bind pflags to viper#4543
Open
bosiakov wants to merge 1 commit intoagones-dev:mainfrom
Open
fix(ping): correct flag default and bind pflags to viper#4543bosiakov wants to merge 1 commit intoagones-dev:mainfrom
bosiakov wants to merge 1 commit intoagones-dev:mainfrom
Conversation
Signed-off-by: Eugene <eugenebosyakov@gmail.com>
Collaborator
|
Oh nice catch ! |
Collaborator
|
/gcbrun |
Collaborator
|
Build Failed 😭 Build Id: b0f86c9f-3b60-42a4-88f4-80a3d5a110c7 Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Collaborator
|
/gcbrun It's a flaky test, probably not related |
Collaborator
|
Build Failed 😭 Build Id: a99bfb73-7a8b-4dd6-b41e-3576f762e7ed Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
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.
What this PR does / Why we need it:
Fixes two bugs in
cmd/ping/main.go's command-line flag handling:--udp-rate-limitflag was reading its default fromhttpResponseFlag(a string flag defaulting to"ok").viper.GetFloat64("ok")returns0, so the documented default of20never took effect — the actual default was0.parseEnvFlagscalledpflag.Parse()but never invokedviper.BindPFlags(pflag.CommandLine), so values passed on the command line (--http-response=...,--udp-rate-limit=...) were parsed and then silently dropped — only the viper defaults and the bound env vars surfaced in the resulting config.The fix mirrors the pattern used by every other
cmd/*/main.go(allocator, controller, extensions, processor, sdk-server), all of which callruntime.Must(viper.BindPFlags(pflag.CommandLine))after theirBindEnvcalls.