1
0
mirror of https://github.com/golang/go synced 2024-11-23 17:40:03 -07:00

cmd/compile/internal/types2: use strings.ReplaceAll for goTypeName

strings.ReplaceAll is currently available.

Change-Id: I111b97f12723c97791b59d81fd035a0d5e97cd4b
GitHub-Last-Rev: 561dbab6d2
GitHub-Pull-Request: golang/go#62369
Reviewed-on: https://go-review.googlesource.com/c/go/+/524157
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Jes Cok 2023-08-30 05:09:56 +00:00 committed by Gopher Robot
parent 9dea791a7a
commit ffc4ccea07

View File

@ -207,7 +207,7 @@ func (check *Checker) genericType(e syntax.Expr, cause *string) Type {
// goTypeName returns the Go type name for typ and // goTypeName returns the Go type name for typ and
// removes any occurrences of "types2." from that name. // removes any occurrences of "types2." from that name.
func goTypeName(typ Type) string { func goTypeName(typ Type) string {
return strings.Replace(fmt.Sprintf("%T", typ), "types2.", "", -1) // strings.ReplaceAll is not available in Go 1.4 return strings.ReplaceAll(fmt.Sprintf("%T", typ), "types2.", "")
} }
// typInternal drives type checking of types. // typInternal drives type checking of types.