Custom Build Steps on GolangCI.com

Denis Isaev
golangci
Published in
1 min readNov 29, 2018

One of our customers requested custom build commands to perform a code generation before analysis. We’ve implemented it and today we’ve released it to all customers.

How to Configure

We’ve made the wiki page with the description of configuration directives.

The example of configuration:

# https://github.com/golangci/golangci/wiki/Configuration

service:
prepare:
- apt-get update && apt-get install -y libsecret-1-dev

What Can Be Configured

  1. custom build steps
  2. vanity import path for the project
  3. golangci-lint version

Why it’s Important

After we’ve migrated to go/packages in golangci-lint we can’t analyze a repository if we can’t fetch some dependencies or we miss some autogenerated code. Custom build steps allow proper fetching of dependencies, code generation etc.

We try to autodetect vanity import paths but it’s not always possible. Now you can configure it.

Setting fixed golangci-lint version is useful for consistent results with your CI.

How it’s Implemented

We run Docker containers with the gVisor runtime to ensure isolation of containers for security. We use golangci/build-runner image.

--

--