nishanths/exhaustive

"_" should be excluded

Closed this issue · 3 comments

sni commented

It is quite common to skip entries in iota lists like this so you can explicitly distinguish an unset value:

const (
	_ SortDirection = iota
	Asc
	Desc
)

However, this throws a false positive:

missing cases in switch of type SortDirection: _ (exhaustive)

So i suggest removing the _ when reading the enum.

Agree _ should be ignored, thanks. I can make the change.

I'll submit a pull request to update the package in golangci-lint.

sni commented

great, thanks for the quick fix