-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: fetch flags from bazel help as proto #18
Conversation
@@ -0,0 +1,600 @@ | |||
package bazel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This likely needs a different license header stamped in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, and/or a vendor folder like Go idiom prescribes
go.bzl
Outdated
@@ -1033,10 +1033,10 @@ def deps(): | |||
) | |||
go_repository( | |||
name = "org_golang_x_tools", | |||
build_directives = ["gazelle:exclude **/testdata/**/*"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦌 gazelle did this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally, Gazelle is starting to ignore testdata
.
pkg/bazel/flags.go
Outdated
func (b *Bazel) Flags() map[string]*FlagInfo { | ||
helpCmdBuffer := new(bytes.Buffer) | ||
|
||
if _, err := b.RunCommand([]string{"help", "flags-as-proto"}, helpCmdBuffer); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO to memoize the flags keyed on the bazel version
d309c13
to
6a51191
Compare
Adds the ability to fetch all the flags from
bazel help flags-as-proto
.This includes a vendored
pkg/bazel/bazelisk.go
file as a small tweak to the exposed API is required to pass in the stream on which to write the response.Includes the generated
flags.pb.go
file so my editor was happy, I'll add agenerated_file_test
if this is an okay approach. (but I like the IDE with no red squiggles)I'd like some help with line 32 in
pkg/bazel/flags.go
, it always raises an error, but the unmarshalled proto is fine :/