Verify whether there is a Value before overriding
This commit is contained in:
parent
8e16b98d40
commit
7ecfd216b1
@ -118,7 +118,9 @@ func (f *TimestampFlag) Apply(set *flag.FlagSet) error {
|
||||
if f.Layout == "" {
|
||||
return fmt.Errorf("timestamp Layout is required")
|
||||
}
|
||||
f.Value = &Timestamp{}
|
||||
if f.Value == nil {
|
||||
f.Value = &Timestamp{}
|
||||
}
|
||||
f.Value.SetLayout(f.Layout)
|
||||
|
||||
if val, ok := flagFromEnvOrFile(f.EnvVars, f.FilePath); ok {
|
||||
|
Loading…
Reference in New Issue
Block a user