1
0
mirror of https://github.com/golang/go synced 2024-10-01 11:18:32 -06:00

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 <crawshaw@golang.org>
This commit is contained in:
Russ Cox 2017-01-18 13:40:24 -05:00
parent 6dad55aa25
commit 76db88ab4d
2 changed files with 8 additions and 6 deletions

View File

@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package main // Package bug implements the ``go bug'' command.
package bug
import ( import (
"bytes" "bytes"
@ -18,11 +19,11 @@ import (
"cmd/go/internal/base" "cmd/go/internal/base"
"cmd/go/internal/cfg" "cmd/go/internal/cfg"
envcmd "cmd/go/internal/env" "cmd/go/internal/envcmd"
"cmd/go/internal/web" "cmd/go/internal/web"
) )
var cmdBug = &base.Command{ var CmdBug = &base.Command{
Run: runBug, Run: runBug,
UsageLine: "bug", UsageLine: "bug",
Short: "start a bug report", Short: "start a bug report",
@ -33,7 +34,7 @@ The report includes useful system information.
} }
func init() { func init() {
cmdBug.Flag.BoolVar(&cfg.BuildV, "v", false, "") CmdBug.Flag.BoolVar(&cfg.BuildV, "v", false, "")
} }
func runBug(cmd *base.Command, args []string) { 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.Fprint(&buf, "#### System details\n\n")
fmt.Fprintln(&buf, "```") fmt.Fprintln(&buf, "```")
fmt.Fprintf(&buf, "go version %s %s/%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH) 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()...) env = append(env, envcmd.ExtraEnvVars()...)
for _, e := range env { for _, e := range env {
// Hide the TERM environment variable from "go bug". // Hide the TERM environment variable from "go bug".

View File

@ -14,6 +14,7 @@ import (
"strings" "strings"
"cmd/go/internal/base" "cmd/go/internal/base"
"cmd/go/internal/bug"
"cmd/go/internal/cfg" "cmd/go/internal/cfg"
"cmd/go/internal/env" "cmd/go/internal/env"
fmtcmd "cmd/go/internal/fmt" fmtcmd "cmd/go/internal/fmt"
@ -29,7 +30,7 @@ func init() {
cmdClean, cmdClean,
cmdDoc, cmdDoc,
env.CmdEnv, env.CmdEnv,
cmdBug, bug.CmdBug,
cmdFix, cmdFix,
fmtcmd.CmdFmt, fmtcmd.CmdFmt,
cmdGenerate, cmdGenerate,