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>
}
}()
- var (
+ const (
pathLine = "path\t"
modLine = "mod\t"
depLine = "dep\t"
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
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):