From e2fb0e1ccaaedf5c4004db01593a0773cd626006 Mon Sep 17 00:00:00 2001 From: GrĂ©goire DuchĂȘne Date: Sat, 3 Dec 2022 21:30:28 +0000 Subject: Remove MutableFlagValue We can just have an ad hoc interface and not clutter the API. --- flag.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/flag.go b/flag.go index 4ef45d1..018540a 100644 --- a/flag.go +++ b/flag.go @@ -83,7 +83,7 @@ func InitFlagSet(fs *flag.FlagSet, env []string, cfg map[string]string, args []s } if f.DefValue != f.Value.String() { - if _, ok := f.Value.(MutableFlagValue); !ok { + if _, ok := f.Value.(interface{ MutableFlag() }); !ok { return } } @@ -108,13 +108,6 @@ func InitFlagSet(fs *flag.FlagSet, env []string, cfg map[string]string, args []s return err } -// MutableFlagValue is used to signal whether it is safe to set a flag -// to another value if it has already been set before, i.e. if its -// current value (as a string) is the same as its default value. -type MutableFlagValue interface { - MutableFlagValue() -} - // ParseString returns the string passed with no error set. func ParseString(s string) (string, error) { return s, nil -- cgit v1.2.3-70-g09d2