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

x/exp/cmd/gorelease: support -json and -f flags #37561

Open
Tracked in #46371
jayconrod opened this issue Feb 28, 2020 · 5 comments
Open
Tracked in #46371

x/exp/cmd/gorelease: support -json and -f flags #37561

jayconrod opened this issue Feb 28, 2020 · 5 comments
Labels
FeatureRequest modules NeedsFix Tools
Milestone

Comments

@jayconrod
Copy link
Contributor

@jayconrod jayconrod commented Feb 28, 2020

gorelease prints its findings to stdout as plain text. The report format may change over time and can't be safely read by tools.

gorelease should accept -json and -f flags, which should produce either JSON or text/template output.

@jayconrod jayconrod added NeedsFix FeatureRequest modules Tools labels Feb 28, 2020
@jayconrod jayconrod added this to the Unreleased milestone Feb 28, 2020
@jayconrod jayconrod removed this from the Unreleased milestone Oct 14, 2020
@jayconrod jayconrod added this to the gorelease milestone Oct 14, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Dec 29, 2020

Change https://golang.org/cl/280772 mentions this issue: x/exp/cmd/gorelease: support -json flag

@jadekler
Copy link
Member

@jadekler jadekler commented Dec 29, 2020

I've started looking into the json side of things in https://go-review.googlesource.com/c/exp/+/280772. I think it's approachable, but will require adding JSON methods and implementing json.Marshaler in various places.

Some questions though:

  • Are we intending on still panic'ing/log.Exit'ing normally, or should those be json format too?
  • I'm fairly new to text/template. Does it start by defining the data structure (same struct as JSON struct?) and then basically template.New(...).Parse(-f flag)?

In general seems like the complexity here is to define a data structure that makes sense of all the outputs, and giving it .Text/.Template/.JSON methods, rather than printing to buffers in various places. Does that seem right?

@jayconrod
Copy link
Contributor Author

@jayconrod jayconrod commented Jan 5, 2021

I'd rather hold off on -json and -f until basically everything else is done. These flags will let other programs consume gorelease output, but the output isn't stable yet, so it wouldn't be safe to use these flags.

About implementation, we'll need to change or at least export the field names in the report type so that encoding/json and text/template can see them via reflection. Hopefully, we won't need to implement json.Marshaler or define any special methods.

@jadekler
Copy link
Member

@jadekler jadekler commented Jan 5, 2021

I'd rather hold off on -json and -f until basically everything else is done.

SGTM

About implementation, we'll need to change or at least export the field names in the report type so that encoding/json and text/template can see them via reflection.

Aha, this makes more sense. Thanks.

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 8, 2021

Change https://golang.org/cl/333371 mentions this issue: cmd/gorelease: support -json and -f flags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest modules NeedsFix Tools
Projects
None yet
Development

No branches or pull requests

3 participants