From: Russ Cox Date: Wed, 18 Jan 2017 18:40:24 +0000 (-0500) Subject: cmd/go: split out cmd/go/internal/bug X-Git-Tag: go1.9beta1~1747 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=76db88ab4db6c95731d32dc4eefafa674db1203a;p=gostls13.git cmd/go: split out cmd/go/internal/bug This is one CL in a long sequence of changes to break up the go command from one package into a plausible group of packages. This sequence is concerned only with moving code, not changing or cleaning up code. There will still be more cleanup after this sequence. The entire sequence will be submitted together: it is not a goal for the tree to build at every step. For #18653. Change-Id: I05629567cc33fef41bc74eba4f7ff66e4851343c Reviewed-on: https://go-review.googlesource.com/36203 Reviewed-by: David Crawshaw --- diff --git a/src/cmd/go/bug.go b/src/cmd/go/internal/bug/bug.go similarity index 96% rename from src/cmd/go/bug.go rename to src/cmd/go/internal/bug/bug.go index f19d8c78ab..963da94c49 100644 --- a/src/cmd/go/bug.go +++ b/src/cmd/go/internal/bug/bug.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package main +// Package bug implements the ``go bug'' command. +package bug import ( "bytes" @@ -18,11 +19,11 @@ import ( "cmd/go/internal/base" "cmd/go/internal/cfg" - envcmd "cmd/go/internal/env" + "cmd/go/internal/envcmd" "cmd/go/internal/web" ) -var cmdBug = &base.Command{ +var CmdBug = &base.Command{ Run: runBug, UsageLine: "bug", Short: "start a bug report", @@ -33,7 +34,7 @@ The report includes useful system information. } func init() { - cmdBug.Flag.BoolVar(&cfg.BuildV, "v", false, "") + CmdBug.Flag.BoolVar(&cfg.BuildV, "v", false, "") } func runBug(cmd *base.Command, args []string) { @@ -43,7 +44,7 @@ func runBug(cmd *base.Command, args []string) { fmt.Fprint(&buf, "#### System details\n\n") fmt.Fprintln(&buf, "```") fmt.Fprintf(&buf, "go version %s %s/%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH) - env := cfg.NewEnv + env := cfg.CmdEnv env = append(env, envcmd.ExtraEnvVars()...) for _, e := range env { // Hide the TERM environment variable from "go bug". diff --git a/src/cmd/go/main.go b/src/cmd/go/main.go index 5b7aa8a1c4..30c7a64c53 100644 --- a/src/cmd/go/main.go +++ b/src/cmd/go/main.go @@ -14,6 +14,7 @@ import ( "strings" "cmd/go/internal/base" + "cmd/go/internal/bug" "cmd/go/internal/cfg" "cmd/go/internal/env" fmtcmd "cmd/go/internal/fmt" @@ -29,7 +30,7 @@ func init() { cmdClean, cmdDoc, env.CmdEnv, - cmdBug, + bug.CmdBug, cmdFix, fmtcmd.CmdFmt, cmdGenerate,