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
go list -e -f '{{.Error.Pos}} => {{.Error.Err}}' .
stdout 'p.go:1:9 => illegal character'
-- go.mod --
module example.com/first
go 1.12
-- p.go --
package ?
What did you expect to see?
The .Error.Pos field should be populated with the position where the error occurred, in this case, the location of the illegal character.
A potential problem here is that there may be multiple errors, and there isn't a reasonable way to report all of them with positions, given the current structure of the JSON output. We should at least report the position for the first error.
What did you see instead?
The position is printed in the error message instead of the .Error.Pos field.
=>
p.go:1:9: illegal character U+003F '?'
This also confuses golang.org/x/tools/go/packages and tools like gopls based on it.
The text was updated successfully, but these errors were encountered:
Error positions should be printed, when specified.
Also, made main_test less picky about whitespace before and after
error output.
After this change, the test for cmd/fiximports should pass before and
after CL 210938.
Updates golang/go#36087
Change-Id: I681d1ee07f7f19a0d9716b88678e2737f4c691de
Reviewed-on: https://go-review.googlesource.com/c/tools/+/211337
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
This makes the error handling in loadImport somewhat more uniform,
with no discernable effect on reported errors.
Noticed in CL 303869.
Updates #36087
Updates #38034
This somewhat simplifies the code, with no discernable effect on
Change-Id: I30521f658f264d6f99d1844d6701269bbb372246
Reviewed-on: https://go-review.googlesource.com/c/go/+/304069
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
The
.Error.Pos
field should be populated with the position where the error occurred, in this case, the location of the illegal character.A potential problem here is that there may be multiple errors, and there isn't a reasonable way to report all of them with positions, given the current structure of the JSON output. We should at least report the position for the first error.
What did you see instead?
The position is printed in the error message instead of the
.Error.Pos
field.This also confuses
golang.org/x/tools/go/packages
and tools likegopls
based on it.The text was updated successfully, but these errors were encountered: