The New Golangci-lint: Even More Faster

Denis Isaev
golangci
Published in
2 min readNov 24, 2018

In the last month, we’ve released two versions of golangci-lint with a lot of new features: v1.11 and v1.12.

What’s New

I will list the biggest changes.

Go/packages Support

The library go/packages is the program loader, it is the replacement of older go/loader. Golangci-lint uses the program loader to parse the whole program: extract AST, type information and then build SSA if needed. Both libraries are official libraries, but the new one has some killer features:

  1. it supports loading type information from a go build cache: because of that almost all linters became “fast”: they work in 1–2 seconds. Only unparam, interfacer and megacheck are “slow” linters now. An average project is analyzed 20–40% faster than before if all linters are
    enabled! If we enable all linters except unparam, interfacer and
    megacheck the analysis is 10–20x faster!
  2. it supports go modules: now we can analyze repos outside of GOPATH.
  3. it supports more build systems: not only go build, but e.g. bazel

Change The License From AGPL to GPL

Some organizations disallow the usage of open-source projects with AGPL license. We’ve changed the license to GPL.

New Linters

We’ve supported 4 cool linters:

  1. go-critic: the most opinionated Go source code linter for code audit.
  2. scopelint: checks for unpinned variables in go programs.
  3. gochecknoinits: checks that no init functions are present in Go code.
  4. gochecknoglobals: checks that no globals are present in Go code.

Other Changes

  1. support exclude flags for errcheck
  2. update imports formatting: use the new goimports
  3. support local-prefix option for goimports: it puts imports beginning with this option after 3rd-party packages

--

--