go-hasdefault

go-hasdefault

a go linter to check switch statements for default

github.com/nathants/go-hasdefault

what

a go linter to check that all switch statements have a default case.

why

sometimes a missing default is an error.

install

go install github.com/nathants/go-hasdefault@latest

usage

>> go-hasdefault $(find test/good/ -name '*.go')

>> go-hasdefault $(find test/bad/ -name '*.go')
test/bad/bad.go:3: switch statement missing default case