Rules_go: no such package '@com_github_cespare_xxhash//': The repository could not be resolved

Created on 22 Jun 2018  路  4Comments  路  Source: bazelbuild/rules_go

Running latest 0.12.1 and gazelle 0.12.

Build file:

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:

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

Things I've done to Resolve

  • I've tried 12.0 and 11 versions with no luck
  • manually generated the BUILD.bazel file
  • looked through all the issues related to this and couldn't find / understand a fix that would work

Here is a link to the open source project build file:

https://github.com/senior7515/smf/blob/master/src/go/smf/BUILD.bazel

Most helpful comment

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.

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jayconrod picture jayconrod  路  6Comments

blico picture blico  路  4Comments

ixdy picture ixdy  路  4Comments

dlorenc picture dlorenc  路  7Comments

jarreds picture jarreds  路  7Comments