Commit 44903c46
44903c460266Merged
Sviatoslav Dumchenko <[email protected]> ยท 3 years ago ยท 1 file ยท ~1 modified
Description
fix: make generics type constraint stricter
Details
- Commit
- 44903c460266
- Parent
- f510bb3ce5fc
pkg/kubedog/errors.gomodifiedView file
@@ -29,17 +29,16 @@
2929
}3030
}3131
32-
type InvalidValueError[T any] struct {32+
type InvalidValueError[T ~string] struct {3333
value T3434
annotation string3535
choices []T3636
}3737
38-
func NewInvalidValueError[T any](annotation string, value T, choices []T) error {38+
func NewInvalidValueError[T ~string](annotation string, value T, choices []T) error {3939
return &InvalidValueError[T]{annotation: annotation, value: value, choices: choices}4040
}4141
42-
//nolint:govet // %q works perfectly4342
func (err InvalidValueError[T]) Error() string {4443
return fmt.Sprintf(4544
"invalid value %q for annotation %q, should be one of %q",