From: Ian Lance Taylor Date: Wed, 23 Oct 2024 00:24:56 +0000 (-0700) Subject: runtime/debug: minor cleanups after CL 384154 X-Git-Tag: go1.24rc1~631 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d0631b90a3b0934d0fe223e2d889d785d297f083;p=gostls13.git runtime/debug: minor cleanups after CL 384154 Change some vars to consts, remove some unneeded string conversions. Change-Id: Ib12eed11ef080c4b593c8369bb915117e7100045 Reviewed-on: https://go-review.googlesource.com/c/go/+/621838 LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Dmitri Shuralyov --- diff --git a/src/runtime/debug/mod.go b/src/runtime/debug/mod.go index 8a1b1666bd..53bbf1d847 100644 --- a/src/runtime/debug/mod.go +++ b/src/runtime/debug/mod.go @@ -161,7 +161,7 @@ func ParseBuildInfo(data string) (bi *BuildInfo, err error) { } }() - var ( + const ( pathLine = "path\t" modLine = "mod\t" depLine = "dep\t" @@ -202,7 +202,7 @@ func ParseBuildInfo(data string) (bi *BuildInfo, err error) { switch { case strings.HasPrefix(line, pathLine): elem := line[len(pathLine):] - bi.Path = string(elem) + bi.Path = elem case strings.HasPrefix(line, modLine): elem := strings.Split(line[len(modLine):], tab) last = &bi.Main @@ -227,9 +227,9 @@ func ParseBuildInfo(data string) (bi *BuildInfo, err error) { return nil, fmt.Errorf("replacement with no module on previous line") } last.Replace = &Module{ - Path: string(elem[0]), - Version: string(elem[1]), - Sum: string(elem[2]), + Path: elem[0], + Version: elem[1], + Sum: elem[2], } last = nil case strings.HasPrefix(line, buildLine):