Skip to content

go-jsonnet fails as a dependency in bzlmod using Gazelle #779

@antholeole

Description

@antholeole

x-post from stackoverflow

I've put together an MVP for a build failure relating to gazelle and com_github_google_go_jsonnet: https://github.com/antholeole/bug-repro/tree/bazel

in short, I have a BUILD.bazel that looks like this:

go_library(
    name = "src_lib",
    srcs = ["main.go"],
    importpath = "repro/src",
    visibility = ["//visibility:private"],
    deps = ["@com_github_google_go_jsonnet//:go-jsonnet"],
)

building the target (in the repro, //src:src) gives the following output:

no such package '@@[unk
nown repo 'cpp_jsonnet' requested from @@gazelle++go_deps+com_github_google_go_jsonnet]//stdlib': The repository '@@[unknown repo 'cpp_jsonnet' requested from @@gazelle++go_deps+com_
github_google_go_jsonnet]' could not be resolved: No repository visible as '@cpp_jsonnet' from repository '@@gazelle++go_deps+com_github_google_go_jsonnet' and referenced by '@@gazel
le++go_deps+com_github_google_go_jsonnet//astgen:dumpstdlibast'

is there any way to supply the dependency with @cpp_jsonnet? I've tried to add a module that looks like that to the MODULE.bazel (the error changed but did not go away completely), but it smells like an antipattern. Hopefully there's an easier way to get jsonnet with gazelle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions