Skip to main content
Version: 0.18.x

golangci-lint

API for declaring a golangci-lint lint aspect that visits go_library, go_test, and go_binary rules.

load("@aspect_rules_lint//lint:golangci-lint.bzl", "golangci_lint_aspect")

golangci_lint = golangci_lint_aspect(
binary = "@multitool//tools/golangci-lint",
config = "@@//:.golangci.yaml",
)

Macros and Functions

golangci_lint_action

Run golangci-lint as an action under Bazel.

Based on https://github.com/golangci/golangci-lint

Example usage (generated):

load("@aspect_rules_lint//lint:golangci-lint.bzl", "golangci_lint_action")

golangci_lint_action(
# Bazel Rule or Aspect evaluation context
ctx = None,
# label of the the golangci-lint program
executable = None,
# golang files to be linted
srcs = [],
# label of the .golangci.yaml file
config = None,
# output file to generate
report = None,
)

ctx

Required.

Bazel Rule or Aspect evaluation context

executable

Required.

label of the the golangci-lint program

srcs

Required.

golang files to be linted

config

Required.

label of the .golangci.yaml file

report

Required.

output file to generate

use_exit_code

Optional. Default: False

whether to fail the build when a lint violation is reported

lint_golangci_aspect

A factory function to create a linter aspect.

Attrs: binary: a golangci-lint executable. config: the .golangci.yaml file

Example usage (generated):

load("@aspect_rules_lint//lint:golangci-lint.bzl", "lint_golangci_aspect")

lint_golangci_aspect(
binary = None,
config = None,
)

binary

Required.

config

Required.