Fix golangci-lint OOM
- Dominant language
- Go
- Stars
- 11.5k
- Forks
- 1.4k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 53
Description
`golangci-lint` is causing intermittent ci failures due to OOM.
Investigate ways to mitigate, probably using `GOGC`:
https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
The Prometheus team is already doing this:
https://github.com/prometheus/prometheus/blob/abdcbda82a62f2a7ebffe428b90e2d1e41e0fa06/.circleci/config.yml#L23-L24
Relates to:
https://github.com/golangci/golangci-lint/issues/483
CI output:
```bash
$ ./bin/lint --verbose
golangci/golangci-lint info checking GitHub for tag 'v1.17.1'
golangci/golangci-lint info found version: 1.17.1 for v1.17.1/linux/amd64
golangci/golangci-lint info installed ./golangci-lint
level=info msg="[config_reader] Config search paths: [./ /home/travis/gopath/src/github.com/linkerd/linkerd2 /home/travis/gopath/src/github.com/linkerd /home/travis/gopath/src/github.com /home/travis/gopath/src /home/travis/gopath /home/travis /home /]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[lintersdb] Active 18 linters: [bodyclose deadcode depguard goconst gofmt goimports golint gosimple govet ineffassign misspell nakedret scopelint typecheck unconvert unparam unused varcheck]"
level=info msg="[lintersdb] Optimized sublinters [gosimple unused] into metalinter megacheck"
level=info msg="[loader] Go packages loading at mode load types and syntax took 8.794657226s"
level=info msg="[loader] SSA repr building timing: packages building 57.642335ms, total 1.952875111s"
fatal error: runtime: out of memory
runtime stack:
runtime.throw(0xe7a20d, 0x16)
/home/travis/.gimme/versions/go1.12.5.linux.amd64/src/runtime/panic.go:617 +0x72
runtime.sysMap(0xc19c000000, 0x4000000, 0x18001b8)
/home/travis/.gimme/versions/go1.12.5.linux.amd64/src/runtime/mem_linux.go:170 +0xc7
```
Contributor guide
Research direction
Start with the ./bin/lint entry point, the .golangci.yml configuration, and the CI configuration that invokes linting. Review the linked golangci-lint memory guidance and the Prometheus .circleci/config.yml example, then verify CI no longer intermittently reaches the reported runtime out-of-memory failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- ci-cd, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100