adhere to the widespread comment directive format #1658
Description
In Go, //go:*
is reserved for the Go toolchain. See https://golang.org/cmd/compile/.
It is encouraged that other Go tools use a similar "namespace" prefix for their comment directives. For example, //gccgo:*
, //lint:*
for staticcheck, //go-sumtype:*
, and so on. See https://groups.google.com/g/golang-dev/c/r4rdPdsH1Fg/m/tNZazPenX5cJ.
golangci-lint kind of does this, but not really. https://golangci-lint.run/usage/false-positives/#nolint gives this example:
var bad_name int //nolint
That's no good, because it clearly does not adhere to the widespread format. It is not formally defined, but in practice it follows something like ^[a-z]+:[a-z]+
.
A possible fix would be //nolint:all
, which is also clearer. Another option would be to follow staticcheck's https://staticcheck.io/docs/configuration/#line-based-linter-directives, which already follows the format with //lint:ignore ...
.
Activity