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

cmd/go: generate: be more informative/verbose #67471

Open
adonovan opened this issue May 17, 2024 · 7 comments
Open

cmd/go: generate: be more informative/verbose #67471

adonovan opened this issue May 17, 2024 · 7 comments
Labels
FeatureRequest GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@adonovan
Copy link
Member

Running go generate ./... can take a while in a large project, but it is not easy to know why. It doesn't print a summary of what commands it ran, and neither -x nor -v lead to intelligible output. It would be nice if -v would print additional logging of the start and end time of each command, along with the location of the directive that triggered it, in a format such as this:

internal/protocol/command/interface.go:5: go run -tags=generate generate.go [start] 
...logs...
internal/protocol/command/interface.go:5: go run -tags=generate generate.go [success, 1.23s] 

@matloob

@adonovan adonovan added this to the Go1.24 milestone May 17, 2024
@matloob matloob added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels May 17, 2024
@matloob
Copy link
Contributor

matloob commented May 17, 2024

cc @samthanawalla

One option could be to put that information into a -json flag.

@adonovan
Copy link
Member Author

One option could be to put that information into a -json flag.

I don't think JSON output is appropriate. The consumer is always a human, never a machine.

@rsc
Copy link
Contributor

rsc commented May 17, 2024

Why does -x not lead to appropriate output?

@adonovan
Copy link
Member Author

adonovan commented May 17, 2024

Why does -x not lead to appropriate output?

It tells me neither the package nor file on whose behalf a command is being executed, nor the timing of the commands, which would be helpful to understand why my generators are conspicuously slow.

@matloob
Copy link
Contributor

matloob commented May 23, 2024

I think -json could be useful because we could make tools that can parse the go test (and go build once it's added) output and show the performance of the steps. I think it would be nice if the same tools could be used when looking at the performance of a test, build, or generate.

@adonovan
Copy link
Member Author

I think -json could be useful

Build and test seem like things that you want to parse in your CI system so that you can present a fancy dashboard UI, but CI systems don't generally run go generate (because in general it is non-hermetic, requiring tools and data that don't exist in the repo). So I don't really see it. Don't let me stop you from adding -json, but I don't think it solves the problem of this issue.

@matloob
Copy link
Contributor

matloob commented May 23, 2024

Hm, we shouldn't add -json if it doesn't help. We'll have to think about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants