]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: split out cmd/go/internal/fmt
authorRuss Cox <rsc@golang.org>
Wed, 18 Jan 2017 18:18:56 +0000 (13:18 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 3 Feb 2017 20:31:49 +0000 (20:31 +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: I8e325d75f553b5d0b6224b56a705d2e2cb895de4
Reviewed-on: https://go-review.googlesource.com/36199
Reviewed-by: David Crawshaw <crawshaw@golang.org>
src/cmd/go/internal/fmt/fmt.go [moved from src/cmd/go/fmt.go with 95% similarity]
src/cmd/go/main.go

similarity index 95%
rename from src/cmd/go/fmt.go
rename to src/cmd/go/internal/fmt/fmt.go
index 169a653e7e4fb9447df820be8cea70f03ae51b3f..1124beeedb6575120cc77fb14d50c3c37ddbc2da 100644 (file)
@@ -2,22 +2,23 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package main
+package fmt
 
 import (
+       "os"
+       "path/filepath"
+
        "cmd/go/internal/base"
        "cmd/go/internal/cfg"
        "cmd/go/internal/load"
        "cmd/go/internal/str"
-       "os"
-       "path/filepath"
 )
 
 func init() {
-       cfg.AddBuildFlagsNX(&cmdFmt.Flag)
+       cfg.AddBuildFlagsNX(&CmdFmt.Flag)
 }
 
-var cmdFmt = &base.Command{
+var CmdFmt = &base.Command{
        Run:       runFmt,
        UsageLine: "fmt [-n] [-x] [packages]",
        Short:     "run gofmt on package sources",
index 502e5716827847cf6320cc6daff4105a6fda45a6..8be210f1d116f2748b8272c8092bf312e5b9d410 100644 (file)
@@ -15,6 +15,7 @@ import (
 
        "cmd/go/internal/base"
        "cmd/go/internal/cfg"
+       fmtcmd "cmd/go/internal/fmt"
        "cmd/go/internal/help"
        "cmd/go/internal/test"
        "cmd/go/internal/work"
@@ -28,7 +29,7 @@ func init() {
                cmdEnv,
                cmdBug,
                cmdFix,
-               cmdFmt,
+               fmtcmd.CmdFmt,
                cmdGenerate,
                cmdGet,
                work.CmdInstall,