aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2022-12-03 21:30:28 +0000
committerGrégoire Duchêne <gduchene@awhk.org>2022-12-03 21:30:28 +0000
commite2fb0e1ccaaedf5c4004db01593a0773cd626006 (patch)
treebc384cab6a3efe3ea02e2d34841aca022c8a4926
parent6f81c7e746a3c7917f9d0efc1a6b34d905135866 (diff)
Remove MutableFlagValue
We can just have an ad hoc interface and not clutter the API.
-rw-r--r--flag.go9
1 files changed, 1 insertions, 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