-
Notifications
You must be signed in to change notification settings - Fork 220
nit: remove double validation on folder when register flag #2173
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,10 +186,6 @@ func Load(r io.Reader) (*Config, error) { | |
| } | ||
| cfg.sanitize() | ||
|
|
||
| if err := cfg.Validate(); err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
|
Comment on lines
-189
to
-192
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Load should validate
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 |
||
| return cfg, nil | ||
| } | ||
|
|
||
|
|
@@ -237,8 +233,8 @@ func RegisterFlags(app *kingpin.Application) ConfigUpdaterFn { | |
| logLevel := app.Flag(LogLevelFlag, "Logging level: debug, info, warn, error").Default("info").Enum("debug", "info", "warn", "error") | ||
| logFormat := app.Flag(LogFormatFlag, "Logging format: text or json").Default("text").Enum("text", "json") | ||
| // host | ||
| hostSysFS := app.Flag(HostSysFSFlag, "Host sysfs path").Default("/sys").ExistingDir() | ||
| hostProcFS := app.Flag(HostProcFSFlag, "Host procfs path").Default("/proc").ExistingDir() | ||
|
Comment on lines
-240
to
-241
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets not make it String since we must ensure the that the directory exists |
||
| hostSysFS := app.Flag(HostSysFSFlag, "Host sysfs path").Default("/sys").String() | ||
| hostProcFS := app.Flag(HostProcFSFlag, "Host procfs path").Default("/proc").String() | ||
|
|
||
| // monitor | ||
| monitorInterval := app.Flag(MonitorIntervalFlag, | ||
|
|
@@ -308,7 +304,7 @@ func RegisterFlags(app *kingpin.Application) ConfigUpdaterFn { | |
| } | ||
|
|
||
| cfg.sanitize() | ||
| return cfg.Validate() | ||
| return nil | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
Lets not make it the responsibility of the caller to validate the config.