{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/15813","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/15813/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/15813/comments","events_url":"https://api.github.com/repos/golang/go/issues/15813/events","html_url":"https://github.com/golang/go/issues/15813","id":156411542,"number":15813,"title":"text/scanner: revert CL 19622?","user":{"login":"rsc","id":104030,"avatar_url":"https://avatars.githubusercontent.com/u/104030?v=3","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"griesemer","id":8528975,"avatar_url":"https://avatars.githubusercontent.com/u/8528975?v=3","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/43","html_url":"https://github.com/golang/go/milestones/Go1.7Beta","labels_url":"https://api.github.com/repos/golang/go/milestones/43/labels","id":1783753,"number":43,"title":"Go1.7Beta","description":"Issues that must be fixed for Go 1.7 beta.\r\n","creator":{"login":"rsc","id":104030,"avatar_url":"https://avatars.githubusercontent.com/u/104030?v=3","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":2,"state":"open","created_at":"2016-05-23T22:20:22Z","updated_at":"2016-05-24T16:28:16Z","due_on":"2016-05-30T04:00:00Z","closed_at":null},"comments":2,"created_at":"2016-05-24T03:16:02Z","updated_at":"2016-05-24T20:00:33Z","closed_at":null,"body":"[CL 19622](https://golang.org/cl/19622) inserted a text/scanner prefix at the beginning of any error printed to standard error.\n\nThis was motivated by confusion on #14166 about where some output was coming from. But the fix seems to me a regression, at least in the case where the scanner knows the file name. If, say, a program like a compiler or assembler were using text/scanner to lex its input and using text/scanner's default error implementation (that is, not providing a custom error implementation), then previously an invocation reporting a lexical problem might look like:\n\n```\n$ myprogram foo.txt\nfoo.txt:10:12: illegal hexadecimal number\n$\n```\n\nNow it looks like:\n\n```\n$ myprogram foo.txt\ntext/scanner: foo.txt:10:12: illegal hexadecimal number\n$\n```\n\nI do understand that if the file name is not known, then this is confusing, as in #14166:\n\n```\n$ myprogram < foo.txt\n10:12: illegal hexadecimal number\n$\n```\n\nBut perhaps the fix, if one must be made, would be to replace an empty file name with a pseudo-name like `<input>`, as in:\n\n```\n$ myprogram < foo.txt\n<input>:10:12: illegal hexadecimal number\n$\n```\n\nI think this form makes it clearer that 10:12 is an input position, without exposing an implementation detail (namely the use of text/scanner).\n\nThe critical point here is that the errors printed by text/scanner are expected by the users of text/scanner; they are a natural part of the operation of scanning input.\n\nIn contrast, in the rare case where a package prints a message to standard error to report an problem such as a consistency violation, that message is not unexpected and so a prefix is entirely appropriate.\n\nI suggest text/scanner be changed to remove the new text/scanner prefix and possibly print `<input>` instead of an empty file name at the beginning of an error message (but not in Position.String, which might have other users)."},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/221384856","html_url":"https://github.com/golang/go/issues/15813#issuecomment-221384856","issue_url":"https://api.github.com/repos/golang/go/issues/15813","id":221384856,"user":{"login":"gopherbot","id":8566911,"avatar_url":"https://avatars.githubusercontent.com/u/8566911?v=3","gravatar_id":"","url":"https://api.github.com/users/gopherbot","html_url":"https://github.com/gopherbot","followers_url":"https://api.github.com/users/gopherbot/followers","following_url":"https://api.github.com/users/gopherbot/following{/other_user}","gists_url":"https://api.github.com/users/gopherbot/gists{/gist_id}","starred_url":"https://api.github.com/users/gopherbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopherbot/subscriptions","organizations_url":"https://api.github.com/users/gopherbot/orgs","repos_url":"https://api.github.com/users/gopherbot/repos","events_url":"https://api.github.com/users/gopherbot/events{/privacy}","received_events_url":"https://api.github.com/users/gopherbot/received_events","type":"User","site_admin":false},"created_at":"2016-05-24T20:00:32Z","updated_at":"2016-05-24T20:00:32Z","body":"CL https://golang.org/cl/23402 mentions this issue."}}
{"actor":{"display_login":"gopherbot"}}