You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
In the errors.join proposal, the proposed api had the user specify how they wanted the errors to be formatted together. But the actual implementation omitted and only used new line.
This is quite unfortunate if you are using slog and want to log that error and very much need a log statement to not span multiple lines. It also makes it much harder to read.
Does anyone recall why sep was dropped?
Thanks,
Joe
Ian Lance Taylor
unread,
Aug 7, 2023, 8:56:41 PM8/7/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
As far as the slog package it seems to me that a handler can enforce
that individual messages are on a single line. There may be a better
way to address that problem, but I don't think that errors.Join is the
right place for a fix. Any random package can generate multiline
error messages with errors.New("a\nb"), and I've seen plenty that do.
So enforcing single-line messages on errors.Join won't fix the problem
in general.
Ian
Joseph Lorenzini
unread,
Aug 8, 2023, 11:24:56 AM8/8/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ian Lance Taylor, golang-nuts
Thanks that was very helpful. As for your point about slog, yes a custom handler could but I am using the library json handler.
I suppose the proper way to frame my problem is that I am using the slog library handler and I do not want new lines in the message or keys.
Would the go team would be open to providing knobs to control how the handler does formatting? I assumed if I tried opening a proposal like that I’d be told to write a custom handler. :)
Ian Lance Taylor
unread,
Aug 8, 2023, 9:47:38 PM8/8/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Joseph Lorenzini, golang-nuts, Jonathan Amsterdam
[ + jba ]
Jonathan Amsterdam
unread,
Aug 8, 2023, 10:25:35 PM8/8/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
I think you can do what you want with `HandlerOptions.ReplaceAttr`. It is given every attribute, even the message.
It can't change the group names, though, and those can have newlines.
Tamás Gulácsi
unread,
Aug 9, 2023, 7:34:08 AM8/9/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Strange. AFAIK the JSON handler escapes the \n in strings.
jal...@gmail.com
unread,
Aug 10, 2023, 1:35:16 AM8/10/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message