peterbourgon / ff

Flags-first package for configuration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails to compile with Go 1.19~rc2

subpop opened this issue · comments

Fedora 37 (due to be released in the fall of 2022) updated to Go 1.19~rc2. The ff package started failing to compile; it looks like there's a breaking API change in the errors package:

./command_test.go:391:55: second argument to errors.As should not be *error
./command_test.go:409:51: second argument to errors.As should not be *error

You can see the full build log here and the automatically reported FTBFS bug here.

This can be "solved" by changing error to any (or interface{} in order to avoid changing go.mod) for the -As fields here

ff/ffcli/command_test.go

Lines 328 to 334 in ec0e9e8

args []string
parseErrAs error
parseErrIs error
parseErrStr string
runErrAs error
runErrIs error
runErrStr string

I don't particularly like using any, which is less clear than error, but this is the sacrifice the go vet gods have demanded.

Let me know if you'd like a PR with these changes, but it may be worth a different refactor. Using any just seems like a code smell workaround.

Wow, frustrating!