cockroach
cockroach copied to clipboard
lint: add a linter to prohibit map[...]bool in favor of map[...]struct{}
The linter is currently limited to sql/opt/norm package. This commit
was prompted by an article mentioned in the Golang Weekly newsletter.
The rationale is that map[...]struct{} is more efficient, but in some
cases the bool map value is actually desired.
Release note: None
Curious what people think about such a linter in general @cockroachdb/sql-queries.
I'm generally in favor. As you say there are cases where the trinary logic of map[...]bool is actually needed, so it would be nice to have some kind of "nolint" comment or something.
Add an opt-out to disable the linter.
TFTRs!
bors r+