Coder Social home page Coder Social logo

Comments (12)

AmandaCameron avatar AmandaCameron commented on June 26, 2024

I'm guessing something is invalid in your bazel workspace (invalid BUILD file or similar) -- that command is a shell-out to bazel, to get a list of the go_* rules your workspace defines.

What version of bazel are you using, I've only tested recently against bazel 0.10.0

from bazel-gopath.

alidabir avatar alidabir commented on June 26, 2024

Thanks for the reply. Here's my bazel version output:
Build label: 0.8.1-homebrew
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Dec 5 19:33:07 2017 (1512502387)
Build timestamp: 1512502387
Build timestamp as int: 1512502387

I upgraded to Build label: 0.11.1-homebrew but am still getting the same error.

from bazel-gopath.

AmandaCameron avatar AmandaCameron commented on June 26, 2024

Do you get the same error if you run bazel query //...?

from bazel-gopath.

alidabir avatar alidabir commented on June 26, 2024

No, I get a directory listing.

from bazel-gopath.

AmandaCameron avatar AmandaCameron commented on June 26, 2024

I'm not sure then, sorry. You can try and run the query directly with bazel query "deps(kind('_?go_.*|proto_compile rule', //...))" and see if it outputs anything useful with that, but it sounds a lot like there's something in your workspace that bazel doesn't like, or you're missing a dependency or similar. If the project can build using bazel, then it's def. a bug in bazel-gopath, but I don't think that's the case here.

from bazel-gopath.

alidabir avatar alidabir commented on June 26, 2024

The project actually builds using bazel. It should be something else.
When I manually run the command you mentioned I get errors:

ERROR: /private/var/tmp/_bazel_XXX/2c0a8c662162eefb40a61715a529d743/external/com_github_shirou_gopsutil/internal/common/BUILD.bazel:3:1: no such package '@com_github_stackexchange_wmi//': The repository could not be resolved and referenced by '@com_github_shirou_gopsutil//internal/common:go_default_library'
ERROR: /private/var/tmp/_bazel_XXX/2c0a8c662162eefb40a61715a529d743/external/com_github_shirou_gopsutil/cpu/BUILD.bazel:3:1: no such package '@com_github_stackexchange_wmi//': The repository could not be resolved and referenced by '@com_github_shirou_gopsutil//cpu:go_default_library'
ERROR: /private/var/tmp/_bazel_XXX/2c0a8c662162eefb40a61715a529d743/external/com_github_spf13_cobra/BUILD.bazel:3:1: no such package '@com_github_inconshreveable_mousetrap//': The repository could not be resolved and referenced by '@com_github_spf13_cobra//:go_default_library'
ERROR: /private/var/tmp/_bazel_XXX/2c0a8c662162eefb40a61715a529d743/external/com_github_shirou_gopsutil/cpu/BUILD.bazel:3:1: no such package '@com_github_stackexchange_wmi//': The repository could not be resolved and referenced by '@com_github_shirou_gopsutil//cpu:go_default_library'
ERROR: Evaluation of query "deps(kind('_?go_.*|proto_compile rule', //...))" failed: errors were encountered while computing transitive closure

from bazel-gopath.

AmandaCameron avatar AmandaCameron commented on June 26, 2024

Does the gopath get properly built? It'll be in $workspace/.gopath by default. I'm guessing those errors are just missing dependencies for parts of the libraries you don't use.

from bazel-gopath.

alidabir avatar alidabir commented on June 26, 2024

A .gopath directory gets built in the project. It contains everything except protos.

from bazel-gopath.

AmandaCameron avatar AmandaCameron commented on June 26, 2024

What are you using to generate the protobuf .go files? I've been using the rules_protobuf rules, so I might not be handling the go_rule protobufs properly.

I'm open to a PR to fix it to work with those, but I have little interest in working on it myself, as we can't use the rules_go protobuf rules in our own code.

from bazel-gopath.

alidabir avatar alidabir commented on June 26, 2024

I too am using rules_protobuf to build my project and it builds all the protobufs. Strange that bazel-gopath can't build those. I'm very new to this whole world of bazel and am kind of clueless. I think we should just leave it at that for now. Could be something very specific to my project configuration. Thanks for the help anyways :)

from bazel-gopath.

AmandaCameron avatar AmandaCameron commented on June 26, 2024

bazel-gopath doesn't do any building itself. It just talks to bazel to find out all the files, and builds a symlink-based gopath for use with other go tools such as gocode and the various source hopping things.

For protobuf stuff you will need to run the build once so that the source files get generated. Before doing that there will be the symlinks in the .gopath, but they will point to invalid files, which rules_protobuf will fill out after it's run.

It's also possible rules_protobuf has changed, as we've not updated that in our bazel for a bit, We're currently using the following rule in our WORKSPACE:

git_repository(
    name = "org_pubref_rules_protobuf",
    remote = "https://github.com/pubref/rules_protobuf.git",
    commit = "d5d5a8e30b81599e25f1ff54ea870ab0194b96df", # https://github.com/pubref/rules_protobuf/pull/172 @ 2018-02-13
)

I'll try and find some time tomorrow to dig into it and make sure nothing needs tweaking for newer versions of rules_protobuf

from bazel-gopath.

AmandaCameron avatar AmandaCameron commented on June 26, 2024

Appologies, It was a bug in bazel-gopath after all. Sorry for the confusion, I was apparently running an older version of the bazel-gopath binary locally, so I didn't notice the bug that sneaked it's way in.

from bazel-gopath.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.