]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: report an error URL with error messages
authorRobert Griesemer <gri@golang.org>
Tue, 23 May 2023 22:50:13 +0000 (15:50 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 24 May 2023 00:18:17 +0000 (00:18 +0000)
commite0db8ab6e0d26fe1e05f6824cff670c61f38a3a4
treecb3ea2dee04e69eace69b44abf6f3264be01b7d9
parent0df681248862a34ff1233cdc4cf0b036e4761652
cmd/compile: report an error URL with error messages

In the type checkers, add Config.ErrorURL (or Config._ErrorURL for
go/types) to configure whether and how an error message should report
a URL for errors that have an error code.

In the compiler, configure types2 to report an error URL of the form
" [go.dev/e/XXX]", where XXX stands for the error code, with the URL
appended to the first line of an error.

Rename the compiler flag -url to -errorurl. At the moment this flag
is disabled by default.

Example for a one-line error message:

<pos>: undefined: f [go.dev/e/UndeclaredName]

Example for a multi-line error message:

<pos>: not enough arguments in call to min [go.dev/e/WrongArgCount]
have ()
want (P, P)

Change-Id: I26651ce2c92ad32fddd641f003db37fe12fdb1cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/497715
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/base/flag.go
src/cmd/compile/internal/base/print.go
src/cmd/compile/internal/noder/irgen.go
src/cmd/compile/internal/types2/api.go
src/cmd/compile/internal/types2/api_test.go
src/cmd/compile/internal/types2/errors.go
src/go/types/api.go
src/go/types/api_test.go
src/go/types/check_test.go
src/go/types/errors.go