Commit 6dad55aa authored by Russ Cox's avatar Russ Cox

cmd/go: split out cmd/go/internal/get

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: Iec17bf2243de129942ae5fba126ec5f217be7303
Reviewed-on: https://go-review.googlesource.com/36202Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
parent cc03ba32
...@@ -2,14 +2,7 @@ ...@@ -2,14 +2,7 @@
// 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.
// +build !cmd_go_bootstrap package get
// This code is compiled into the real 'go' binary, but it is not
// compiled into the binary that is built during all.bash, so as
// to avoid needing to build net (and thus use cgo) during the
// bootstrap process.
package main
import ( import (
"encoding/xml" "encoding/xml"
......
...@@ -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 get implements the ``go get'' command.
package get
import ( import (
"fmt" "fmt"
...@@ -22,7 +23,7 @@ import ( ...@@ -22,7 +23,7 @@ import (
"cmd/go/internal/work" "cmd/go/internal/work"
) )
var cmdGet = &base.Command{ var CmdGet = &base.Command{
UsageLine: "get [-d] [-f] [-fix] [-insecure] [-t] [-u] [build flags] [packages]", UsageLine: "get [-d] [-f] [-fix] [-insecure] [-t] [-u] [build flags] [packages]",
Short: "download and install packages and dependencies", Short: "download and install packages and dependencies",
Long: ` Long: `
...@@ -78,16 +79,16 @@ See also: go build, go install, go clean. ...@@ -78,16 +79,16 @@ See also: go build, go install, go clean.
`, `,
} }
var getD = cmdGet.Flag.Bool("d", false, "") var getD = CmdGet.Flag.Bool("d", false, "")
var getF = cmdGet.Flag.Bool("f", false, "") var getF = CmdGet.Flag.Bool("f", false, "")
var getT = cmdGet.Flag.Bool("t", false, "") var getT = CmdGet.Flag.Bool("t", false, "")
var getU = cmdGet.Flag.Bool("u", false, "") var getU = CmdGet.Flag.Bool("u", false, "")
var getFix = cmdGet.Flag.Bool("fix", false, "") var getFix = CmdGet.Flag.Bool("fix", false, "")
var getInsecure = cmdGet.Flag.Bool("insecure", false, "") var getInsecure = CmdGet.Flag.Bool("insecure", false, "")
func init() { func init() {
work.AddBuildFlags(cmdGet) work.AddBuildFlags(CmdGet)
cmdGet.Run = runGet // break init loop CmdGet.Run = runGet // break init loop
} }
func runGet(cmd *base.Command, args []string) { func runGet(cmd *base.Command, args []string) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// 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 get
import ( import (
"bytes" "bytes"
......
...@@ -17,6 +17,7 @@ import ( ...@@ -17,6 +17,7 @@ import (
"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"
"cmd/go/internal/get"
"cmd/go/internal/help" "cmd/go/internal/help"
"cmd/go/internal/test" "cmd/go/internal/test"
"cmd/go/internal/work" "cmd/go/internal/work"
...@@ -32,7 +33,7 @@ func init() { ...@@ -32,7 +33,7 @@ func init() {
cmdFix, cmdFix,
fmtcmd.CmdFmt, fmtcmd.CmdFmt,
cmdGenerate, cmdGenerate,
cmdGet, get.CmdGet,
work.CmdInstall, work.CmdInstall,
cmdList, cmdList,
cmdRun, cmdRun,
......
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