Hello all, I'm incorporating golangci-lint <https://golangci-lint.run/usage/linters/> linter aggregator in my codebase and facing a dilemma on how to mark false positives for these 2 linters:
- errcheck - reports unchecked errors. - unparam - reports unused function parameters. The "official" way is to use special comment directives that make linter ignore the line: func foo( name string, //nolint:unparam age int, ) { //nolint:errcheck file, _ := os.Open(name) .... Another, may be more portable way, would be using special functions which do nothing: // defined in some library utilities package func IgnoreErr(err error) {} func Unused(a any) {} func foo( name string, age int, ) { Unused(age) file, err := os.Open(name) IgnoreErr(err) ... What do you think the proper/idiomatic/better way among these two? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/6fc8a933-b68c-4e07-a4ee-98c4fe01ba8dn%40googlegroups.com.