-
Notifications
You must be signed in to change notification settings - Fork 352
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
config: expose FlagSet #2959
config: expose FlagSet #2959
Conversation
Signed-off-by: Markus Meyer <[email protected]>
b1d638f
to
05ec684
Compare
Signed-off-by: Markus Meyer <[email protected]>
2bfbcb4
to
4f4ae0c
Compare
👍 |
Tests need also a change to set or use the member as far as I see go actions output |
Signed-off-by: Markus Meyer <[email protected]>
@@ -336,8 +336,8 @@ func Test_NewConfigWithArgs(t *testing.T) { | |||
} | |||
|
|||
if !tt.wantErr { | |||
if cmp.Equal(cfg, tt.want, cmp.AllowUnexported(listFlag{}, pluginFlag{}, defaultFiltersFlags{}, mapFlags{}), cmpopts.IgnoreUnexported(Config{})) == false { | |||
t.Errorf("config.NewConfig() got vs. want:\n%v", cmp.Diff(cfg, tt.want, cmp.AllowUnexported(listFlag{}, pluginFlag{}, defaultFiltersFlags{}, mapFlags{}), cmpopts.IgnoreUnexported(Config{}))) | |||
if cmp.Equal(cfg, tt.want, cmp.AllowUnexported(listFlag{}, pluginFlag{}, defaultFiltersFlags{}, mapFlags{}), cmpopts.IgnoreUnexported(Config{}), cmpopts.IgnoreFields(Config{}, "Flags")) == false { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@szuecs The failing test has been addressed. Before this PR, the value of Config.flags
was not considered for comparison during these tests because of cmpopts.IgnoreUnexported(Config{})
. Added cmpopts.IgnoreFields(Config{}, "Flags")
to re-create the behavior of ignoring the field.
👍 |
Thank you! |
👍 |
Thanks for the reviews and the merge! |
We are using skipper as a library. Configuration for custom code, like filters, gets passed in via command-line flags.
This worked well until #2248 got merged, which switched to a
flag.FlagSet
to manage configuration. Now, starting Skipper and passing in custom flags fails with the errorflag provided but not defined
.This change adds a method that makes the
FlagSet
accessible from outside. It allows users to add custom flags to the `FlagSet.