diff options
| author | Sebastiaan van Stijn <[email protected]> | 2025-09-01 12:48:45 +0200 |
|---|---|---|
| committer | Sebastiaan van Stijn <[email protected]> | 2025-09-01 23:10:11 +0200 |
| commit | 18a9d17d0ee8bd64d5c2071fc031be86fa2cd328 (patch) | |
| tree | b9ff208cf79a488329fddf768cd832b21cbaaa94 /string_array_test.go | |
| parent | c5b9e989df31c5d19573e50d6188550ad51a971e (diff) | |
move Func, BoolFunc, tests as they require go1.21
Commit 69bc3bd5b37fa90e994be9acecf7430269591713 added support for Func()
and BoolFunc() to match stdlib. However, the Func method was added in
[go1.16.0], and BoolFunc in [go1.21.0], so running the tests on older
versions of Go would fail;
docker run -it --rm -v ./:/pflag -w /pflag golang:1.21 sh -c 'go test -v ./...'
# github.com/spf13/pflag [github.com/spf13/pflag.test]
./bool_func_test.go:86:28: cannot use stdFSet (type *flag.FlagSet) as type BoolFuncFlagSet in argument to runCase:
*flag.FlagSet does not implement BoolFuncFlagSet (missing BoolFunc method)
./bool_func_test.go:113:21: undefined: io.Discard
./bool_func_test.go:116:28: cannot use stdFSet (type *flag.FlagSet) as type BoolFuncFlagSet in argument to runCase:
*flag.FlagSet does not implement BoolFuncFlagSet (missing BoolFunc method)
./bool_func_test.go:139:7: undefined: errors.Is
./func_test.go:92:28: cannot use stdFSet (type *flag.FlagSet) as type FuncFlagSet in argument to runCase:
*flag.FlagSet does not implement FuncFlagSet (missing Func method)
./func_test.go:119:21: undefined: io.Discard
./func_test.go:122:28: cannot use stdFSet (type *flag.FlagSet) as type FuncFlagSet in argument to runCase:
*flag.FlagSet does not implement FuncFlagSet (missing Func method)
./func_test.go:145:7: undefined: errors.Is
./func_test.go:145:7: too many errors
FAIL github.com/spf13/pflag [build failed]
This patch moves the tests to a separate file that is not built for older
versions of Go.
[go1.16.0]: https://pkg.go.dev/[email protected]#Func
[go1.21.0]: https://pkg.go.dev/[email protected]#BoolFunc
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Diffstat (limited to 'string_array_test.go')
0 files changed, 0 insertions, 0 deletions
