gochecknoglobals icon indicating copy to clipboard operation
gochecknoglobals copied to clipboard

Check that no globals are present in Go code.

Results 8 gochecknoglobals issues
Sort by recently updated
recently updated
newest added

### Proposal Change linter to allow globals and disallow mutation of global variables. ### Why This linter's goal is to reduce side-effects that arise out of global (package level) variables....

I have some code like this: ``` var ( someRegex = regexp.MustCompile(`(?P[.+])`) someRegexIndex = someRegex.SubexpIndex("foo") ) ``` which the linter considers OK on the `regexp.MustCompile` line but not on the...

There are a number of a issues open and past related to exceptions for patterns where Go's lack of ability to do `const` for many classes of pre-initialized values such...

Hello, First, thank you for providing this linter! I am using it as part of `golangci-lint`. I am now working on a project that have some `regex.Must` in global variables...

~~This PR extends #12 which will only allow global error variables prefixed with `Err` if they're assigned from `fmt.Errorf` or `errors.New`.~~ ~~This branch is based on `whitelisted-selectors` which makes the...

Using the guidance here: https://pkg.go.dev/cmd/go/internal/generate This tool should ignore files which contain the `^// Code generated .* DO NOT EDIT\.$` regex match. This can be a flag or default, but...

If regexp is fine, strings.NewReplacer is fine, too.

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`....