Skip to content

go vet using more memory than all the other checks combined #598

@ncw

Description

@ncw

I was trying to work out why golangci-lint is using 5GB of memory, so I disabled the linters one at a time. I discovered disabling the govet linter reduces the memory from 5,335,264k to 2,665,052k so just govet on its own is using 2.5GB of RAM.

The measurements were taken using time -v golangci-lint and taking the Maximum resident set size (kbytes)

I think this might be indicative of a problem. I tried with the master version and this is improved from 5,335,264k to 3,906,860k which is better but not best!

This is on https://github.com/ncw/rclone

  1. Version of golangci-lint: golangci-lint --version (or git commit if you don't use binary distribution)
$ golangci-lint --version
golangci-lint has version 1.17.1 built from 4ba2155 on 2019-06-10T09:06:49Z
  1. Config file: cat .golangci.yml
# golangci-lint configuration options

linters:
  enable: # numbers show k of RAM used for each option on its own
    - deadcode    # 1130400
    - errcheck    # 1155060
    - goimports   #  109252
    - golint      #  181900
    - ineffassign #  104260
    - structcheck # 1162180
    - varcheck    # 1157420
    - govet       # 3173336
    - unconvert   # 1149696
    #- prealloc
    #- maligned
  disable-all: true

issues:
  # Enable some lints excluded by default
  exclude-use-default: false

  # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
  max-per-linter: 0

  # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
  max-same-issues: 0
  1. Go environment: go version && go env
$ go version && go env
go version go1.12.6 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ncw/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ncw/go"
GOPROXY=""
GORACE=""
GOROOT="/opt/go/go1.12"
GOTMPDIR=""
GOTOOLDIR="/opt/go/go1.12/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build142887997=/tmp/go-build -gno-record-gcc-switches"
  1. Verbose output of running: golangci-lint run -v
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /home/ncw/go/src/github.com/ncw/rclone /home/ncw/go/src/github.com/ncw /home/ncw/go/src/github.com /home/ncw/go/src /home/ncw/go /home/ncw /home /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 9 linters: [deadcode errcheck goimports golint govet ineffassign structcheck unconvert varcheck] 
INFO [loader] Go packages loading at mode load types and syntax took 4.128727585s 
INFO [loader] SSA repr building timing: packages building 39.410238ms, total 666.606199ms 
INFO [runner] worker.4 took 5.823383433s with stages: govet: 5.134636322s, varcheck: 250.451169ms, deadcode: 151.105242ms, errcheck: 102.373427ms, structcheck: 94.187916ms, unconvert: 90.583216ms 
INFO [runner] worker.3 took 5.866044967s with stages: ineffassign: 5.866036553s 
INFO [runner] worker.2 took 8.265849768s with stages: goimports: 8.265831935s 
INFO [runner] worker.1 took 10.925640836s with stages: golint: 10.925627368s 
INFO [runner] Workers idle times: #2: 2.64882149s, #3: 5.03845539s, #4: 5.101301831s 
INFO [runner] Issues before processing: 7, after processing: 0 
INFO [runner] processing took 3.091587ms with stages: nolint: 2.481695ms, autogenerated_exclude: 234.869µs, identifier_marker: 182.104µs, skip_dirs: 118.612µs, cgo: 24.374µs, path_prettifier: 16.986µs, max_same_issues: 10.871µs, skip_files: 8.903µs, filename_unadjuster: 6.413µs, diff: 2.353µs, exclude: 912ns, exclude-rules: 694ns, max_from_linter: 651ns, uniq_by_line: 624ns, max_per_file_from_linter: 560ns, path_shortener: 520ns, source_code: 446ns 
INFO File cache stats: 0 entries of total size 0B 
INFO Memory: 74 samples, avg is 2466.7MB, max is 5554.9MB 
INFO Execution took 15.785717043s                 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions