Commit 76db88ab authored by Russ Cox's avatar Russ Cox

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/36203Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
parent 6dad55aa
...@@ -2,7 +2,8 @@ ...@@ -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 ( ...@@ -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. ...@@ -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) { ...@@ -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".
......
...@@ -14,6 +14,7 @@ import ( ...@@ -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() { ...@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment