I'm using bazel/gazelle to pull in some external git repositories. For example:
go_repository(
name = "com_github_pkg_errors",
importpath = "github.com/pkg/errors",
sum = "h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=",
version = "v0.8.1",
)
My go file would just import github.com/pkg/errors
like normal.
Problem comes when I run go vet
on my file. It would complain that no such package exists under GOROOT or GOPATH. This repo is located in my bazel cache. ~/.cache/bazel/.../external/com_github_pkg_errors
How can I resolve this?
go.mod
BUILD.bazel
file of your project, specifygo_library
withdep