unparam
unparam copied to clipboard
False positive for functions in map
var cmdMap = map[string]func() error{
"cmd1": func() error { // OK
return errors.New("foo")
},
"cmd2": func() error { // false positive
return nil
},
}
In this code, I think it's pretty clear cmd2 needs to have an error return because the signature of the map value mandates it, but it gets flagged as "result 0 (error) is always nil".
Possibly a duplicate of #40
This really needs to be fixed. Putting nolint everywhere is defeating the purpose, so I will probably be uninstalling the linter.