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

fmt, errors: empty messages in the error chain result in ugly messages #30683

Closed
rogpeppe opened this issue Mar 8, 2019 · 6 comments
Closed

fmt, errors: empty messages in the error chain result in ugly messages #30683

rogpeppe opened this issue Mar 8, 2019 · 6 comments

Comments

@rogpeppe
Copy link
Contributor

@rogpeppe rogpeppe commented Mar 8, 2019

$ go version
go version devel +ce7534ff06 Fri Mar 8 13:46:43 2019 +0000 linux/amd64

What did you do?

https://play.golang.org/p/ewauxpVAIji

What did you expect to see?

I would expect to see:

 a: xxxx

What did you see instead?

Instead we see:

a: : xxxx

It's not uncommon to want to wrap errors just to record the location without adding any message (adding an annotation at every level can end up with unwieldy messages), so I think a colon separator should only be printed if there's something to print.

@andybons andybons added this to the Unplanned milestone Mar 8, 2019
@andybons
Copy link
Member

@andybons andybons commented Mar 8, 2019

@jimmyfrasche
Copy link
Member

@jimmyfrasche jimmyfrasche commented Mar 8, 2019

@jba
Copy link
Contributor

@jba jba commented Mar 8, 2019

@robpike robpike changed the title fmt: empty messages in the chain result in ugly messages fmt: empty messages in the error chain result in ugly messages Mar 8, 2019
@bcmills bcmills modified the milestones: Unplanned, Go1.13 Apr 11, 2019
@bcmills bcmills changed the title fmt: empty messages in the error chain result in ugly messages fmt, errors: empty messages in the error chain result in ugly messages Apr 11, 2019
@adg
Copy link
Contributor

@adg adg commented May 31, 2019

Is this bug still current? I don't see an errors.Printer type in the errors package.

@rogpeppe
Copy link
Contributor Author

@rogpeppe rogpeppe commented May 31, 2019

It seems that the error printing stuff has been removed from errors in tip. I'm not sure what the roadmap is here.

@neild
Copy link
Contributor

@neild neild commented Jun 3, 2019

With the removal of FormatError, this is obsolete.

@neild neild closed this Jun 3, 2019
@golang golang locked and limited conversation to collaborators Jun 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.