Running latest 0.12.1 and gazelle 0.12.
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = [
"CompressionFlags.go",
"DynamicHeader.go",
"Header.go",
"HeaderBitFlags.go",
"PayloadHeaders.go",
"client.go",
"connection.go",
"handle.go",
"header_utils.go",
"server.go",
"service.go",
],
importpath = "github.com/senior7515/smf/src/go/smf",
visibility = ["//visibility:public"],
deps = [
"//src/third_party/flatbuffers/go",
"@com_github_cespare_xxhash//:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = ["dispatch_test.go"],
embed = [":go_default_library"],
)
ERROR: /home/agallego/workspace/smf/src/go/smf/BUILD.bazel:3:1: no such package '@com_github_cespare_xxhash//': The repository could not be resolved and referenced by '//src/go/smf:go_default_library'
ERROR: Analysis of target '//src/go/smf:go_default_test' failed; build aborted: no such package '@com_github_cespare_xxhash//': The repository could not be resolved
Here is a link to the open source project build file:
https://github.com/senior7515/smf/blob/master/src/go/smf/BUILD.bazel
It looks like com_github_cespare_xxhash is not declared in your WORKSPACE file. You should be able to add it with:
bazel run //:gazelle -- update-repos github.com/cespare/xxhash
That will add something like this:
go_repository(
name = "com_github_cespare_xxhash",
commit = "48099fad606eafc26e3a569fad19ff510fff4df6",
importpath = "github.com/cespare/xxhash",
)
You may need to run that command again for additional transitive dependencies.
This works great thanks!
Is there a way to avoid bazel run //:gazelle ... ignore some repos
I have some manual deps for c++ cmake (that also happen to have go) in
src/thirdparty/*
when I run bazel run //:gazelle it creates BUILD.bazel files in all transitive projects.
how do i set the default to ignore say all in //src/thirdparty/*
Gazelle can be configured using special comments in build files. In this case, # gazelle:exclude is probably what you need. In your top-level build file, you could write the comment below, and Gazelle won't recurse into that directory:
# gazelle:exclude src/thirdparty
At the moment, there's no way to give it a whitelist of directories, though that would probably be a useful feature.
Awesome thank you! it all works.
Most helpful comment
It looks like
com_github_cespare_xxhashis not declared in your WORKSPACE file. You should be able to add it with:That will add something like this:
You may need to run that command again for additional transitive dependencies.