]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: split out cmd/go/internal/bug
authorRuss Cox <rsc@golang.org>
Wed, 18 Jan 2017 18:40:24 +0000 (13:40 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 3 Feb 2017 20:32:20 +0000 (20:32 +0000)
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 <crawshaw@golang.org>
src/cmd/go/internal/bug/bug.go [moved from src/cmd/go/bug.go with 96% similarity]
src/cmd/go/main.go

similarity index 96%
rename from src/cmd/go/bug.go
rename to src/cmd/go/internal/bug/bug.go
index f19d8c78abde75e8a1ae5e13ea21dacf675817cc..963da94c493c10cb4b47015dbc4a536424e8097c 100644 (file)
@@ -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".
index 5b7aa8a1c4b335f14a318887cbe84f7c2c068969..30c7a64c536edc658f5370bfe4c5be1facc12403 100644 (file)
@@ -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,