You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.
Hi, I've hacked together a small patch that allows running golangci-lint on the generated go code. It relies on @rules_go/go_path to assemble a source tree of all the dependencies and uses that as GOPATH for the golangci-lint invocation.
I've got it to work on my small repo that uses generated code for protobuf libraries and it works. The minimal patch to accept a go_path() output and wire it through GOPATH is at parabolala@3fd012a
It can be used as:
load("@io_bazel_rules_go//go:def.bzl", "go_path")
load("@com_github_atlassian_bazel_tools//golangcilint:def.bzl", "golangcilint")
go_path(
name = "go_root",
deps = [
# Code entry points (go_binary, go_library) to lint.
# All their transitive deps are pulled in and are filtered by "prefix" below.
"//service/cmd/server",
],
include_pkg = True,
)
golangcilint(
name = "golangcilint",
go_path = ":go_root",
prefix = "<prefix matching the code>",
)
Am I missing something essential? Does this look feasible? If yes, I'll be happy to flesh it out into a PR.
The text was updated successfully, but these errors were encountered:
GOPATH is going away within a year, so no point in supporting it. I think this rule just cannot be made to work the way it currently... works. It needs to be redone completely. See this issue for more details #118
On the other hand, if you use this rule and it would be convenient for you to have it with the patch, feel free to submit a PR. It will keep working while Go supports GOPATH and then it will stop. 🤷
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi, I've hacked together a small patch that allows running
golangci-lint
on the generated go code. It relies on@rules_go/go_path
to assemble a source tree of all the dependencies and uses that asGOPATH
for thegolangci-lint
invocation.I've got it to work on my small repo that uses generated code for protobuf libraries and it works. The minimal patch to accept a
go_path()
output and wire it through GOPATH is at parabolala@3fd012aIt can be used as:
Am I missing something essential? Does this look feasible? If yes, I'll be happy to flesh it out into a PR.
The text was updated successfully, but these errors were encountered: