Remove unused flag clearing closures
This commit is contained in:
@@ -19,7 +19,6 @@ func ValueFlag[I, V any](meta FlagMeta, defaultValue *V, parse func(string) (V,
|
||||
return Flag[I]{binding: binding}
|
||||
}
|
||||
binding.valid = true
|
||||
binding.clear = func(input *I) { set(input, Supplied[V]{}) }
|
||||
binding.prepare = func(values []string) (preparedValue[I], error) {
|
||||
value := fallback
|
||||
supplied := len(values) > 0
|
||||
@@ -45,7 +44,6 @@ func BoolFlag[I any](meta FlagMeta, defaultValue bool, set func(*I, Supplied[boo
|
||||
return Flag[I]{binding: binding}
|
||||
}
|
||||
binding.valid = true
|
||||
binding.clear = func(input *I) { set(input, Supplied[bool]{}) }
|
||||
binding.prepare = func(values []string) (preparedValue[I], error) {
|
||||
value := defaultValue
|
||||
supplied := len(values) > 0
|
||||
@@ -73,7 +71,6 @@ func RepeatFlag[I, V any](meta FlagMeta, defaults []V, parse func(string) (V, er
|
||||
return Flag[I]{binding: binding}
|
||||
}
|
||||
binding.valid = true
|
||||
binding.clear = func(input *I) { set(input, Supplied[[]V]{}) }
|
||||
binding.prepare = func(values []string) (preparedValue[I], error) {
|
||||
parsedValues := append([]V(nil), fallback...)
|
||||
supplied := len(values) > 0
|
||||
|
||||
@@ -81,7 +81,6 @@ type flagBinding[I any] struct {
|
||||
repeated bool
|
||||
boolean bool
|
||||
prepare func([]string) (preparedValue[I], error)
|
||||
clear func(*I)
|
||||
valid bool
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +253,14 @@ without an invented automated content-check promise.
|
||||
|
||||
## R6: Remove the obsolete binding-clear mechanism
|
||||
|
||||
**Status:** Open. **Priority:** P3.
|
||||
**Status:** Completed (2026-10-11). **Priority:** P3.
|
||||
|
||||
**Completed work:** verified the field had only constructor assignments and no
|
||||
callers, then removed it and the three unused closures. The removal leaves
|
||||
prepared value application, defaults, presence, and binding identity untouched.
|
||||
A follow-up source search finds no remaining binding-clear mechanism. All three
|
||||
module suites pass offline with Go 1.26.8; formatting and whitespace checks pass.
|
||||
No reset hook or public API change was introduced.
|
||||
|
||||
**Evidence:** [command.go](../../command.go) retains
|
||||
`flagBinding.clear`, and [binding.go](../../binding.go) constructs clear
|
||||
|
||||
Reference in New Issue
Block a user