Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gopackagesdriver failing for go_binary #3270

Closed
DrewMonroe opened this issue Aug 14, 2022 · 3 comments · Fixed by #3271
Closed

gopackagesdriver failing for go_binary #3270

DrewMonroe opened this issue Aug 14, 2022 · 3 comments · Fixed by #3271

Comments

@DrewMonroe
Copy link
Contributor

What version of rules_go are you using?

v0.34.0

What version of gazelle are you using?

v0.24.0

What version of Bazel are you using?

v 5.2.0

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

Arch linux, 5.18.16 kernel, x86_64

Any other potentially useful information about your toolchain?

What did you do?

Configure gopackagesdriver for vim as describe in the docs. Create a go_library, and a go_binary that depends on that library. Vim is able to autocomplete for the go_library, but not the go_binary. Specifically, the bazel query command run by gopackagesdriver is not returning the name of build target, causing an error when bazel build is run by the driver.

Adding go_binary to the return of the fileQuery function for the BazelJSONBuilder struct solves the problem.

What did you expect to see?

Vim should have autocompletion options.

What did you see instead?

No autocompletion options.

I'm happy to submit a PR for the one line change, but wanted to create an issue to make sure this behavior wasn't intentional.

@fmeum
Copy link
Collaborator

fmeum commented Aug 14, 2022

I'm not too familiar with the code, but I don't see a reason why we wouldn't want to list go_binary there. @linzhp What do you think?

@linzhp
Copy link
Contributor

linzhp commented Aug 15, 2022

yeah, that's reasonable. Can you send a pull request?

@DrewMonroe
Copy link
Contributor Author

Yup I'd be happy to. Thanks for the sanity check

DrewMonroe added a commit to DrewMonroe/rules_go that referenced this issue Aug 17, 2022
As discussed in bazelbuild#3270, The current implementation of `bazel_json_builder`
does not handle `go_binary` build rules. This means that when
`gopackagesdriver` attempts to be used on a file that is apart of a
`go_binary`, no build target is produced as the output of `bazel query`.
This prevents downstream utilities (`gopls`) from being able to provide
functionality such as autocompletion support.

This PR simply adds `go_binary` as a supported rule type, fixing bazelbuild#3270.
fmeum pushed a commit that referenced this issue Aug 17, 2022
As discussed in #3270, The current implementation of `bazel_json_builder`
does not handle `go_binary` build rules. This means that when
`gopackagesdriver` attempts to be used on a file that is apart of a
`go_binary`, no build target is produced as the output of `bazel query`.
This prevents downstream utilities (`gopls`) from being able to provide
functionality such as autocompletion support.

This PR simply adds `go_binary` as a supported rule type, fixing #3270.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants