We want to distinguish special compiler-generated package paths,
like go.shape, from user paths, like go.opentelemetry.io/otel/semconv.
The former have no slash in them.
Writing a test for this seems hard, as the dependency we'd need to
add would be non-hermetic. (Or it would need a new tricky run.go mode.)
This CL does fix the example in the issue.
Fixes #49606
Change-Id: I38f1b970b6dd31e0617763a27ff227e3afee74d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/365834
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
p := new(Pkg)
p.Path = path
p.Name = name
- if strings.HasPrefix(path, "go.") {
+ if strings.HasPrefix(path, "go.") && !strings.Contains(path, "/") {
// Special compiler-internal packages don't need to be escaped.
// This particularly helps with the go.shape package.
p.Prefix = path