Questions tagged [bazel-gazelle]
15 questions
5
votes
1 answer
Is it possible to automatically load transitive dependencies with Gazelle?
I'd like to use Gazelle to manage my Go dependencies (and their dependencies) in Bazel. Running bazel run //:gazelle update-repos firebase.google.com/go adds a properly configured go_repository to my WORKSPACE file:
go_repository(
name =…

Spencer Connaughton
- 892
- 6
- 21
2
votes
0 answers
Build errors in release version of CGO library
I'm new to CGO and am trying to use the library https://github.com/goccy/go-graphviz. I am trying to compile using Gazelle and Bazel, however, when I run Bazel build I get a huge number of build errors that make me wonder how the project is able to…

NumberOneRobot
- 1,691
- 6
- 17
- 23
2
votes
0 answers
how to resolve definition(GoDef) with gopls when I don't have go.mod file
I have a project, which doesn't use go.mod, and not follow the structure that project is under $GOPATH/src/.... It uses bazel and WORKSPACE file to manage depedencies.
I use gopls in neovim, and it could not resolve imports like import…

DutchBro
- 45
- 4
2
votes
1 answer
How to run Gazelle on list of directories
Context
I have a list of directories
- libs
- lib1
- lib2
- lib3
...
- bin
- WORKSPACE
- BUILD.bazel
...
And I'd like to run gazelle on a subset of these directories that I've whitelisted.
I have hundreds of directories under libs/ and I…

GGhe
- 663
- 5
- 17
1
vote
1 answer
How to use `bazel cquery` to find out who brings an external dependency?
My bazel build fails with the following error
link: package conflict error: github.com/golang/protobuf/ptypes/timestamp: multiple copies of package passed to linker:
@io_bazel_rules_go//proto/wkt:timestamp_go_proto
…

Mohammed
- 637
- 13
- 26
1
vote
0 answers
Building go plugins with gazelle
I'm building a project written in go with the bazel build system and its gazelle extension to automatically generate BUILD files.
The project's file tree is similar to this:
project-root/
... cmd/
... ... cmd1/
... ... cmd2/
... internal/
... ...…

Lior Levin
- 179
- 1
- 13
1
vote
1 answer
Error with Go proto imports when using bazel-gazelle
I have a repository where I'm using gazelle and proto build rules. My repository is structured like this:
WORKSPACE
\ proto
- user.proto
- user_service.proto
- BUILD
This is the BUILD file I have inside my proto…

Mohammed Nadeem
- 21
- 5
1
vote
1 answer
Bazel - BUILD not referencing external dependency
I'm trying to run some grpc tests with bazel.
I'm using "google.golang.org/grpc/credentials/insecure" to dial insecurely.
When running bazel test ..., I get the following error:
no such package '@org_golang_google_grpc//credentials/insecure': BUILD…

Jyan
- 43
- 1
- 1
- 8
1
vote
0 answers
go application build with bazel can't link when running inside container
I am trying to containerize my application build, though, when running the build that uses bazel with bazel-gazelle inside a container I will get this error:
$ bazel run --spawn_strategy=local //:gazelle --verbose_failures
INFO: Analyzed target…

Robson Jr
- 11
- 2
1
vote
1 answer
How to use Bazel platform transitions in a Go Gazelle project
I have a (pure) Go project set up using Gazelle. It has a main binary, its cmd/main/BUILD generated by Gazelle looks like this:
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "main_lib",
srcs =…

joni
- 5,402
- 1
- 27
- 40
1
vote
1 answer
How to get bazel/gazelle go_repository imports past go vet
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 =…

Daiwei Fan
- 11
- 1
0
votes
1 answer
How to tell gazelle that a go file is meant for go_default_test and not go_default_library?
I have a file, embed_testdata.go, meant to be used in tests but does not itself have tests (so I don't want to suffix it with _test.go). How do I tell gazelle that it's really test source and not prod source?
FYI, simply adding it to go_default_test…

Noel Yap
- 18,822
- 21
- 92
- 144
0
votes
1 answer
Run Gazelle in dry-run or warn mode
Context
Is there a way to have gazelle run in dry-run mode?
I'd like to create a CI job that runs gazelle with dry-run and fails if gazelle finds any changes.
Something like this
$ bazel run //:gazelle --dry-run || exit 1
Different Approach
I think…

GGhe
- 663
- 5
- 17
0
votes
0 answers
undefined: gomock.AssignableToTypeOf
I'm getting this error: undefined: gomock.AssignableToTypeOf
It is occurring while using function gomock.AssignableToTypeOf of package github.com/golang/mock"
This starts occurring when I have Updated versions in the WORKSPACE file of Project, and…

Gagan Kalra
- 65
- 9
0
votes
0 answers
Bazel build error with third party library - no such package
I'm using bazel 4.1.0 to build to project.
Current set up:
go.mod file
...
github.com/mwitkow/go-proto-validators v0.3.2 // indirect
...
WORKSPACE file
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies",…

ittus
- 21,730
- 5
- 57
- 57