]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/debug: minor cleanups after CL 384154
authorIan Lance Taylor <iant@golang.org>
Wed, 23 Oct 2024 00:24:56 +0000 (17:24 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 23 Oct 2024 04:48:55 +0000 (04:48 +0000)
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
src/runtime/debug/mod.go

index 8a1b1666bdb321dfa813029cd2c8756356f676b0..53bbf1d847056877696ebf8744402828967482f3 100644 (file)
@@ -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):