Line-level suppression: can suppress warnings on following line
dabfleming opened this issue · comments
Ran into this issue in vs code, but have confirmed using the command line it's not the extension. Take for example the following go file, simplified slightly from something I came across:
package foo
import (
"crypto/md5"
"encoding/hex"
)
// GetMD5Hash is a function...
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
Without any nolint
comments it gives the following output:
$ gometalinter test.go
test.go:4::warning: Blacklisted import crypto/md5: weak cryptographic primitive,MEDIUM,HIGH (gosec)
test.go:10::warning: Use of weak cryptographic primitive,MEDIUM,HIGH (gosec)
test.go:11::warning: Errors unhandled.,LOW,HIGH (gosec)
If I add a // nolint
comment to the end of line 10, the warnings for both line 10 and 11 are suppressed, though if I add a blank line between them, the second warning still appears in output.
Not quite sure what's going on but pretty sure this is not expected behaviour. I just wanted to suppress the weak cryptographic primitive warning, but still be prompted to fix the unhandled error.