From 7f2463cc363fe8dbcbb89d521d1ede650de86c9b Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Wed, 3 Nov 2021 11:26:37 -0700 Subject: [PATCH] cmd/compile: fix up shape type package Use go.shape instead of .shape as the package the compiler uses to store shape types. Prevent path escaping for compiler-internal types, so we don't need to see %2e everywhere. Change-Id: I98e39c3b6472560113bdea7e0ba6eb7b81cb35e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/361174 Trust: Keith Randall Trust: Dan Scales Run-TryBot: Keith Randall TryBot-Result: Go Bot Reviewed-by: Dan Scales --- src/cmd/compile/internal/types/pkg.go | 9 ++++++++- src/cmd/compile/internal/types/type.go | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cmd/compile/internal/types/pkg.go b/src/cmd/compile/internal/types/pkg.go index f63a357f0d..fe42049cee 100644 --- a/src/cmd/compile/internal/types/pkg.go +++ b/src/cmd/compile/internal/types/pkg.go @@ -9,6 +9,7 @@ import ( "cmd/internal/objabi" "fmt" "sort" + "strings" "sync" ) @@ -48,7 +49,13 @@ func NewPkg(path, name string) *Pkg { p := new(Pkg) p.Path = path p.Name = name - p.Prefix = objabi.PathToPrefix(path) + if strings.HasPrefix(path, "go.") { + // Special compiler-internal packages don't need to be escaped. + // This particularly helps with the go.shape package. + p.Prefix = path + } else { + p.Prefix = objabi.PathToPrefix(path) + } p.Syms = make(map[string]*Sym) pkgMap[path] = p diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go index c3efbc9f07..6288df30d6 100644 --- a/src/cmd/compile/internal/types/type.go +++ b/src/cmd/compile/internal/types/type.go @@ -2202,4 +2202,4 @@ var ( var SimType [NTYPE]Kind -var ShapePkg = NewPkg(".shape", ".shape") +var ShapePkg = NewPkg("go.shape", "go.shape") -- 2.48.1