@@ -12,7 +12,7 @@ type JSONConfig struct {
1212 Kind MutationKind
1313 Path string
1414 // For boolean flags that set a specific value when present
15- SetValue interface {}
15+ SetValue any
1616}
1717
1818type JSONValueCreator [T any ] struct {}
@@ -63,11 +63,9 @@ func (v *jsonValue[T]) Set(val string) error {
6363 return nil
6464 }
6565 // For any flags with SetValue, register the configured value
66- if _ , isAny := any (parsed ).(interface {}); isAny {
67- globalRegistry .Mutate (v .config .Kind , v .config .Path , v .config .SetValue )
68- * v .destination = any (v .config .SetValue ).(T )
69- return nil
70- }
66+ globalRegistry .Mutate (v .config .Kind , v .config .Path , v .config .SetValue )
67+ * v .destination = any (v .config .SetValue ).(T )
68+ return nil
7169 }
7270
7371 switch any (parsed ).(type ) {
@@ -114,8 +112,8 @@ func (v *jsonValue[T]) Set(val string) error {
114112 return fmt .Errorf ("invalid datetime value %q: %w" , val , parseErr )
115113 }
116114 parsed = any (timeVal ).(T )
117- case interface {} :
118- // For interface{} , store the string value directly
115+ case any :
116+ // For `any` , store the string value directly
119117 parsed = any (val ).(T )
120118 default :
121119 return fmt .Errorf ("unsupported type for JSON flag" )
@@ -247,4 +245,4 @@ type JSONIntFlag = cli.FlagBase[int, JSONConfig, JSONValueCreator[int]]
247245type JSONFloatFlag = cli.FlagBase [float64 , JSONConfig , JSONValueCreator [float64 ]]
248246type JSONDatetimeFlag = cli.FlagBase [time.Time , JSONConfig , JSONValueCreator [time.Time ]]
249247type JSONDateFlag = cli.FlagBase [time.Time , JSONConfig , JSONDateValueCreator ]
250- type JSONAnyFlag = cli.FlagBase [interface {} , JSONConfig , JSONValueCreator [interface {} ]]
248+ type JSONAnyFlag = cli.FlagBase [any , JSONConfig , JSONValueCreator [any ]]
0 commit comments