Skip to content

Commit

Permalink
x/tools/go/analysis/passes/printf: revert URL in error message
Browse files Browse the repository at this point in the history
Revert CL 422854, which added a URL to this one error message,
shortly after the Go 1.19 release, which means there is still time
to keep it from ending up in Go 1.20.

	% go test
	# runtime/metrics_test
	./description_test.go:61:4: (*testing.common).Errorf format %s has arg samples[0].Value.Kind() of wrong type runtime/metrics.ValueKind, see also https://pkg.go.dev/fmt#hdr-Printing

After this CL the ", see also" will not print.

The URL is undoubtedly helpful in some cases, but it makes the
error much longer and reduces the signal-to-noise ratio.
It is also not clear why this one error deserves special treatment.

We should have a general solution for getting users to details
about the specific errors being printed, not URLs in every message.

This reverts commit 88d981e.

Change-Id: Ib49e1fae94ba837f432d8a65e38e657cfa522668
Reviewed-on: https://go-review.googlesource.com/c/tools/+/462438
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
  • Loading branch information
rsc authored and gopherbot committed Jan 18, 2023
1 parent 2fa6ca1 commit 9ff31a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion go/analysis/passes/printf/printf.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ func okPrintfArg(pass *analysis.Pass, call *ast.CallExpr, state *formatState) (o
if reason != "" {
details = " (" + reason + ")"
}
pass.ReportRangef(call, "%s format %s has arg %s of wrong type %s%s, see also https://pkg.go.dev/fmt#hdr-Printing", state.name, state.format, analysisutil.Format(pass.Fset, arg), typeString, details)
pass.ReportRangef(call, "%s format %s has arg %s of wrong type %s%s", state.name, state.format, analysisutil.Format(pass.Fset, arg), typeString, details)
return false
}
if v.typ&argString != 0 && v.verb != 'T' && !bytes.Contains(state.flags, []byte{'#'}) {
Expand Down

0 comments on commit 9ff31a5

Please sign in to comment.