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

proposal: testing: optional prefix for error output #68613

Closed
firelizzard18 opened this issue Jul 26, 2024 · 2 comments
Closed

proposal: testing: optional prefix for error output #68613

firelizzard18 opened this issue Jul 26, 2024 · 2 comments
Labels
Milestone

Comments

@firelizzard18
Copy link
Contributor

Proposal Details

Proposal

I propose the addition of a go test flag that will add a prefix to the output of t.Error(f) and t.Fatal(f). For example, go test -errlogprefix "Error: " would cause t.Error("it failed") to output Error: it failed.

Alternatively a flag that specifies a template for error message printing would be even more useful, something like -errlogformat "Error: {{.Message}}". Beyond the basic Message field, the context could include additional info such as the location.

Motivation

When the user executes a Go test in vscode (with vscode-go), I want to tell the user what caused the error to fail. vscode provides a mechanism for this - when I report the failure of the test, I can provide messages associated with that failure. However, I have no way of knowing which messages should be associated with the failure. However if this proposal is accepted, I could specify some sequence of bytes as the prefix, and detect that sequence of bytes when processing test output.

@gopherbot gopherbot added this to the Proposal milestone Jul 26, 2024
@gabyhelp
Copy link

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@seankhliao
Copy link
Member

Duplicate of #47080

@seankhliao seankhliao marked this as a duplicate of #47080 Jul 26, 2024
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants