gochecknoglobals icon indicating copy to clipboard operation
gochecknoglobals copied to clipboard

Add allowed-expressions flag

Open 3timeslazy opened this issue 6 months ago • 0 comments

Hi @leighmcculloch,

First of all, thank you for your work!

I noticed that a lot of people asking for exceptions for different frequently used expressions, such as strings.Replace or template.Must. I myself would be happy if the linter could ignore certain expressions rather than putting nolint tag each time or disabling the linter entirely. But I think manually adding exceptions is not scalable, so I made this PR as a proposal of a new allowed-expressions flag.

The format of the flag is a comma separated list of allowed expressions. Each expression has a format of name.Selector. An example: --allowed-expressions=regexp.MustCompile,template.Must.

If the given list is invalid, it is ignored.

Please, let me know what you think.

Thanks!

3timeslazy avatar Aug 24 '24 21:08 3timeslazy