Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

Latest commit

 

History

History

golangcilint

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

golangci-lint

Bazel rule for golangci-lint.

Limitations

This rule does not work with:

  • generated Go code
  • with Bazel-managed Go dependencies
  • with Go modules, unless go mod vendor is used

Consider using nogo from rules_go.

Usage

You can invoke golangcilint via the Bazel rule.

WORKSPACE file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

# golangci-lint needs Go SDK and hence needs rules_go.
# See https://github.com/bazelbuild/rules_go for the up to date setup instructions.
http_archive(
    name = "io_bazel_rules_go",
)

git_repository(
    name = "com_github_atlassian_bazel_tools",
    commit = "<commit>",
    remote = "https://github.com/atlassian/bazel-tools.git",
    shallow_since = "<bla>",
)

load("@com_github_atlassian_bazel_tools//golangcilint:deps.bzl", "golangcilint_dependencies")

golangcilint_dependencies()

BUILD.bazel typically in the workspace root:

load("@com_github_atlassian_bazel_tools//golangcilint:def.bzl", "golangcilint")

golangcilint(
    name = "golangcilint",
    config = "//:.golangcilint.json",
    paths = [
        ".",
        "cmd/...",
        "pkg/...",
    ],
    prefix = "bitbucket.org/<my>/<project>",
)

Invoke with

bazel run //:golangcilint