]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: split out cmd/go/internal/get
authorRuss Cox <rsc@golang.org>
Wed, 18 Jan 2017 18:39:12 +0000 (13:39 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 3 Feb 2017 20:32:12 +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: Iec17bf2243de129942ae5fba126ec5f217be7303
Reviewed-on: https://go-review.googlesource.com/36202
Reviewed-by: David Crawshaw <crawshaw@golang.org>
src/cmd/go/internal/get/discovery.go [moved from src/cmd/go/discovery.go with 89% similarity]
src/cmd/go/internal/get/get.go [moved from src/cmd/go/get.go with 97% similarity]
src/cmd/go/internal/get/vcs.go [moved from src/cmd/go/vcs.go with 99% similarity]
src/cmd/go/main.go

similarity index 89%
rename from src/cmd/go/discovery.go
rename to src/cmd/go/internal/get/discovery.go
index b60eaef739815a59f3ee5dd920d7158e94b2b27a..b2918dbb4f31aaa4488856e68113fee8efecdf2c 100644 (file)
@@ -2,14 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !cmd_go_bootstrap
-
-// 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
+package get
 
 import (
        "encoding/xml"
similarity index 97%
rename from src/cmd/go/get.go
rename to src/cmd/go/internal/get/get.go
index ddbab685403d9231477383645d3bb4238fa336af..3f1349286efe371c1d9f91d74a009add24da238e 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 get implements the ``go get'' command.
+package get
 
 import (
        "fmt"
@@ -22,7 +23,7 @@ import (
        "cmd/go/internal/work"
 )
 
-var cmdGet = &base.Command{
+var CmdGet = &base.Command{
        UsageLine: "get [-d] [-f] [-fix] [-insecure] [-t] [-u] [build flags] [packages]",
        Short:     "download and install packages and dependencies",
        Long: `
@@ -78,16 +79,16 @@ See also: go build, go install, go clean.
        `,
 }
 
-var getD = cmdGet.Flag.Bool("d", false, "")
-var getF = cmdGet.Flag.Bool("f", false, "")
-var getT = cmdGet.Flag.Bool("t", false, "")
-var getU = cmdGet.Flag.Bool("u", false, "")
-var getFix = cmdGet.Flag.Bool("fix", false, "")
-var getInsecure = cmdGet.Flag.Bool("insecure", false, "")
+var getD = CmdGet.Flag.Bool("d", false, "")
+var getF = CmdGet.Flag.Bool("f", false, "")
+var getT = CmdGet.Flag.Bool("t", false, "")
+var getU = CmdGet.Flag.Bool("u", false, "")
+var getFix = CmdGet.Flag.Bool("fix", false, "")
+var getInsecure = CmdGet.Flag.Bool("insecure", false, "")
 
 func init() {
-       work.AddBuildFlags(cmdGet)
-       cmdGet.Run = runGet // break init loop
+       work.AddBuildFlags(CmdGet)
+       CmdGet.Run = runGet // break init loop
 }
 
 func runGet(cmd *base.Command, args []string) {
similarity index 99%
rename from src/cmd/go/vcs.go
rename to src/cmd/go/internal/get/vcs.go
index e6797ad19e5eeccfa363105c8ac1813e31b18e33..187f635557be4cf5d91c1b06c2db42cc6afd440e 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package main
+package get
 
 import (
        "bytes"
index 68a697653702b75e33e7c7f7e5661605a964e755..5b7aa8a1c4b335f14a318887cbe84f7c2c068969 100644 (file)
@@ -17,6 +17,7 @@ import (
        "cmd/go/internal/cfg"
        "cmd/go/internal/env"
        fmtcmd "cmd/go/internal/fmt"
+       "cmd/go/internal/get"
        "cmd/go/internal/help"
        "cmd/go/internal/test"
        "cmd/go/internal/work"
@@ -32,7 +33,7 @@ func init() {
                cmdFix,
                fmtcmd.CmdFmt,
                cmdGenerate,
-               cmdGet,
+               get.CmdGet,
                work.CmdInstall,
                cmdList,
                cmdRun,