]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/types2: use strings.ReplaceAll for goTypeName
authorJes Cok <xigua67damn@gmail.com>
Wed, 30 Aug 2023 05:09:56 +0000 (05:09 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 31 Aug 2023 21:14:38 +0000 (21:14 +0000)
strings.ReplaceAll is currently available.

Change-Id: I111b97f12723c97791b59d81fd035a0d5e97cd4b
GitHub-Last-Rev: 561dbab6d22df42636f34a53a97c2f52b9138f3e
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>

src/cmd/compile/internal/types2/typexpr.go

index bf353427ab5ce1101690fe443bcdc7db4feea855..de420e39c7c1b2e4c6d8feaff99e92448374d6bd 100644 (file)
@@ -207,7 +207,7 @@ func (check *Checker) genericType(e syntax.Expr, cause *string) Type {
 // goTypeName returns the Go type name for typ and
 // removes any occurrences of "types2." from that name.
 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.