You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of Go are you using (go version)?
go version go1.5.2 darwin/amd64
What did you do?
Ran golang text/scanner Scanner on a file.
GOT:
My program was outputting odd error messages to Stderr.
87:17: illegal char escape
But as text/scanner is a small part of the whole program it wasn't obvious what this message was or where it was coming from. I was reviewing a lot of code until i traced all the back to
(The error it self isn't the problem and was correct, it's just the delivery that is the issue).
WANT:
It would be nice to make error output configurable somehow. For my needs, just having a io.Writer (default to os.Stderr) that i can set to ioutil.Discard is all I need but I'm sure others will have more advanced requirements.
thanks all!
nickg
The text was updated successfully, but these errors were encountered:
minux
changed the title
text/scanner hardwired error output to os.Stderr, make configurable
text/scanner: hardwired error output to os.Stderr, make configurable
Jan 31, 2016
It reports scanner errors (read and token errors) by calling s.Error, if not nil; otherwise it prints an error message to os.Stderr.
Note also that you tracked down the offending code, and line 328 above shows the logic invoking s.Error.
But I agree that the default error message should report "text/scanner" so we know where it's coming from. Changed issue title.
griesemer
changed the title
text/scanner: hardwired error output to os.Stderr, make configurable
text/scanner: default error to os.Stderr should mention "text/scanner"
Jan 31, 2016
@griesemer ha! great. I traced down into error() and assumed that since it was a private function so that was the end of that. Duh. Thanks for your help and the update on the ticket. Regards, n
What version of Go are you using (go version)?
go version go1.5.2 darwin/amd64
What did you do?
Ran golang text/scanner Scanner on a file.
GOT:
My program was outputting odd error messages to Stderr.
But as
text/scanner
is a small part of the whole program it wasn't obvious what this message was or where it was coming from. I was reviewing a lot of code until i traced all the back tohttps://golang.org/src/text/scanner/scanner.go?s=14356:14385#L531
(The error it self isn't the problem and was correct, it's just the delivery that is the issue).
WANT:
It would be nice to make error output configurable somehow. For my needs, just having a
io.Writer
(default toos.Stderr
) that i can set toioutil.Discard
is all I need but I'm sure others will have more advanced requirements.thanks all!
nickg
The text was updated successfully, but these errors were encountered: