From: Joel Sing Date: Tue, 13 Sep 2022 09:32:34 +0000 (+1000) Subject: cmd/internal/objabi: declare HeadType String on a non-pointer receiver X-Git-Tag: go1.20rc1~1070 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e084d844208621d0d9c060f8322d242adb26e845;p=gostls13.git cmd/internal/objabi: declare HeadType String on a non-pointer receiver objabi.HeadType is typically used as a non-pointer type, however the String function is declared on a pointer receiver. This means that in most cases its integer value is printed, rather than the value from the String function. Change-Id: I3d28d9680e88a714bc1152ed5e1df4ac43d7a33f Reviewed-on: https://go-review.googlesource.com/c/go/+/430556 Run-TryBot: Cherry Mui TryBot-Result: Gopher Robot Reviewed-by: Jenny Rakoczy Reviewed-by: Cherry Mui Auto-Submit: Jenny Rakoczy --- diff --git a/src/cmd/internal/objabi/head.go b/src/cmd/internal/objabi/head.go index 48ff292307..763910fbd6 100644 --- a/src/cmd/internal/objabi/head.go +++ b/src/cmd/internal/objabi/head.go @@ -80,8 +80,8 @@ func (h *HeadType) Set(s string) error { return nil } -func (h *HeadType) String() string { - switch *h { +func (h HeadType) String() string { + switch h { case Haix: return "aix" case Hdarwin: @@ -105,5 +105,5 @@ func (h *HeadType) String() string { case Hwindows: return "windows" } - return fmt.Sprintf("HeadType(%d)", *h) + return fmt.Sprintf("HeadType(%d)", h) }