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

golangcilint unable to load external deps #63

Closed
mishudark opened this issue Jul 13, 2019 · 1 comment
Closed

golangcilint unable to load external deps #63

mishudark opened this issue Jul 13, 2019 · 1 comment

Comments

@mishudark
Copy link

Bazel version: 0.28.0
Bazel-tools: commit 7c3b97b8e8bf4699353fcdf7437c195e2cdcef3b - Jul 2019

Context: I'm able to run and test the actual project with bazel, but linter seems to not use the external deps defined on WORKSPACE

WORKSPACE:

http_archive(
    name = "com_github_atlassian_bazel_tools",
    strip_prefix = "bazel-tools-6fbc36c639a8f376182bb0057dd557eb2440d4ed",
    urls = ["https://github.com/atlassian/bazel-tools/archive/6fbc36c639a8f376182bb0057dd557eb2440d4ed.zip"],
    sha256 = "544495c6e9b509191c616694ec734a1b7101c85726bd5916a8713225658e33ab"
)

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

go_repository(
    name = "com_google_firebase_go",
    importpath = "firebase.google.com/go",
    sum = "h1:A/KMJdcsLq1/miil8tONEbLBmUgOWpdVCLAxMHq0Xbw=",
    version = "v3.8.1+incompatible",
)

go_repository(
    name = "in_gopkg_check_v1",
    importpath = "gopkg.in/check.v1",
    sum = "h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=",
    version = "v0.0.0-20161208181325-20d25e280405",
)

go_repository(
    name = "in_gopkg_fsnotify_v1",
    importpath = "gopkg.in/fsnotify.v1",
    sum = "h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=",
    version = "v1.4.7",
)

go_repository(
    name = "in_gopkg_tomb_v1",
    importpath = "gopkg.in/tomb.v1",
    sum = "h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=",
    version = "v1.0.0-20141024135613-dd632973f1e7",
)

go_repository(
    name = "in_gopkg_yaml_v2",
    importpath = "gopkg.in/yaml.v2",
    sum = "h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=",
    version = "v2.2.1",
)

go_repository(
    name = "io_opencensus_go",
    importpath = "go.opencensus.io",
    sum = "h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg=",
    version = "v0.21.0",
)

go_repository(
    name = "io_upper_db_v3",
    importpath = "upper.io/db.v3",
    sum = "h1:3MJSnJQ+NMxBxuNwO+gOKFiugwv+f61LbyuZYSPzoi4=",
    version = "v3.5.7+incompatible",
)
...

BUILD.bazel

golangcilint(
    name = "golangcilint",
    paths = [
        "packages/api/pkg/...",
    ],
    prefix = "github.com/my-private-repo/some-app",
)

error:

INFO: Analyzed target //:golangcilint (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:golangcilint up-to-date:
  bazel-bin/golangcilint.bash
INFO: Elapsed time: 0.150s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
ERRO Running error: context loading failed: failed to load program with go/packages: go [list -e -json -compiled -test=true -export=false -deps=true -find=false -- ./packages/api/pkg/...]: exit status 1: go build github.com/golang/protobuf/ptypes/timestamp: no Go files in
go build github.com/golang/protobuf/ptypes/empty: no Go files in
go build github.com/golang/protobuf/proto: no Go files in
go build google.golang.org/grpc: no Go files in
go build google.golang.org/grpc/codes: no Go files in
go build google.golang.org/grpc/status: no Go files in
go build github.com/mishudark/errors: no Go files in
go build github.com/go-redis/redis: no Go files in
go build firebase.google.com/go: no Go files in
go build firebase.google.com/go/messaging: no Go files in
go build github.com/go-ozzo/ozzo-validation: no Go files in
go build upper.io/db.v3/lib/sqlbuilder: no Go files in
go build google.golang.org/api/option: no Go files in
go build github.com/imdario/mergo: no Go files in
go build upper.io/db.v3: no Go files in
go build github.com/lestrrat-go/jwx/jwk: no Go files in
go build github.com/lestrrat-go/jwx/jws: no Go files in
go build google.golang.org/grpc/metadata: no Go files in
@ash2k
Copy link
Contributor

ash2k commented Jul 14, 2019

golangcilint rules in this repo only support vendored dependencies, not dependencies brought in via bazel. I recommend you to use https://github.com/bazelbuild/rules_go/blob/master/go/nogo.rst instead. It is also incremental and cacheable, unlike golangcilint rules.

p.s. I should probably add a deprecation warning to the description.

@ash2k ash2k closed this as completed Jul 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants