Closed vadorovsky closed 6 years ago
The Go language already has a feature for ignoring the result of an assignment, and that is to assign to underscore (_
). Or simply omit the left hand side. If for some reason (documentation?) you want to keep the variable (res
in your example), just assign it to underscore on the next line (_ = res
).
Your example doesn't even pass the compiler's checking, and is thus outside the scope of this tool. As for ignoring ineffessign checks, you'll have to provide compelling reasons (and actual examples) why you don't just fix them instead.
OK, the concrete example is here:
https://github.com/cilium/cilium/blob/master/pkg/bpf/bpffs.go#L261
Yes, ineffassingn complains about that line:
/home/mrostecki/go/src/github.com/cilium/cilium/pkg/bpf/bpffs.go:261:4: ineffectual assignment to err
I would like to ignore that error, because that assignment should be effectual and err
variable is returned at the end of function.
It would be nice to allow to ignore checks by writing comment like:
i.e.