mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/go: use local state object in bug.runBug
This commit modifies `bug.runBug` to construct a new modload.State
object using the new constructor instead of the current global
`modload.LoaderState` variable.
This commit is part of the overall effort to eliminate global
modloader state.
[git-generate]
cd src/cmd/go/internal/bug
rf '
add bug.go:/func runBug\(/-0 var moduleLoaderState *modload.State
ex {
import "cmd/go/internal/modload";
modload.LoaderState -> moduleLoaderState
}
add runBug://+0 moduleLoaderState := modload.NewState()
rm bug.go:/var moduleLoaderState \*modload.State/
'
Change-Id: Ic4f74d2127f667491136ee4bad4388b4d606821e
Reviewed-on: https://go-review.googlesource.com/c/go/+/711123
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
This commit is contained in:
parent
2c4fd7b2cd
commit
9926e1124e
1 changed files with 3 additions and 2 deletions
|
|
@ -42,16 +42,17 @@ func init() {
|
|||
}
|
||||
|
||||
func runBug(ctx context.Context, cmd *base.Command, args []string) {
|
||||
moduleLoaderState := modload.NewState()
|
||||
if len(args) > 0 {
|
||||
base.Fatalf("go: bug takes no arguments")
|
||||
}
|
||||
work.BuildInit(modload.LoaderState)
|
||||
work.BuildInit(moduleLoaderState)
|
||||
|
||||
var buf strings.Builder
|
||||
buf.WriteString(bugHeader)
|
||||
printGoVersion(&buf)
|
||||
buf.WriteString("### Does this issue reproduce with the latest release?\n\n\n")
|
||||
printEnvDetails(modload.LoaderState, &buf)
|
||||
printEnvDetails(moduleLoaderState, &buf)
|
||||
buf.WriteString(bugFooter)
|
||||
|
||||
body := buf.String()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue