summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd/go/build.go20
-rw-r--r--src/cmd/go/run.go2
-rw-r--r--src/cmd/go/test.go2
-rwxr-xr-xsrc/make.bash2
-rwxr-xr-xsrc/run.bash2
5 files changed, 19 insertions, 9 deletions
diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go
index 791ec817d..1fc4a4273 100644
--- a/src/cmd/go/build.go
+++ b/src/cmd/go/build.go
@@ -28,7 +28,7 @@ func init() {
}
var cmdBuild = &Command{
- UsageLine: "build [-a] [-n] [-x] [-o output] [importpath... | gofiles...]",
+ UsageLine: "build [-a] [-n] [-v] [-x] [-o output] [importpath... | gofiles...]",
Short: "compile packages and dependencies",
Long: `
Build compiles the packages named by the import paths,
@@ -44,6 +44,7 @@ serving only as a check that the packages can be built.
The -a flag forces rebuilding of packages that are already up-to-date.
The -n flag prints the commands but does not run them.
+The -v flag prints the names of packages as they are compiled.
The -x flag prints the commands.
The -o flag specifies the output file name.
It is an error to use -o when the command line specifies multiple packages.
@@ -56,12 +57,13 @@ See also: go install, go get, go clean.
var buildA = cmdBuild.Flag.Bool("a", false, "")
var buildN = cmdBuild.Flag.Bool("n", false, "")
+var buildV = cmdBuild.Flag.Bool("v", false, "")
var buildX = cmdBuild.Flag.Bool("x", false, "")
var buildO = cmdBuild.Flag.String("o", "", "output file")
func runBuild(cmd *Command, args []string) {
var b builder
- b.init(*buildA, *buildN, *buildX)
+ b.init(*buildA, *buildN, *buildV, *buildX)
var pkgs []*Package
if len(args) > 0 && strings.HasSuffix(args[0], ".go") {
@@ -95,7 +97,7 @@ func runBuild(cmd *Command, args []string) {
}
var cmdInstall = &Command{
- UsageLine: "install [-a] [-n] [-x] [importpath...]",
+ UsageLine: "install [-a] [-n] [-v] [-x] [importpath...]",
Short: "compile and install packages and dependencies",
Long: `
Install compiles and installs the packages named by the import paths,
@@ -103,6 +105,7 @@ along with their dependencies.
The -a flag forces reinstallation of packages that are already up-to-date.
The -n flag prints the commands but does not run them.
+The -v flag prints the names of packages as they are compiled.
The -x flag prints the commands.
For more about import paths, see 'go help importpath'.
@@ -113,11 +116,12 @@ See also: go build, go get, go clean.
var installA = cmdInstall.Flag.Bool("a", false, "")
var installN = cmdInstall.Flag.Bool("n", false, "")
+var installV = cmdInstall.Flag.Bool("v", false, "")
var installX = cmdInstall.Flag.Bool("x", false, "")
func runInstall(cmd *Command, args []string) {
var b builder
- b.init(*installA, *installN, *installX)
+ b.init(*installA, *installN, *installV, *installX)
a := &action{}
for _, p := range packages(args) {
a.deps = append(a.deps, b.action(modeInstall, modeInstall, p))
@@ -132,6 +136,7 @@ type builder struct {
work string // the temporary work directory (ends in filepath.Separator)
aflag bool // the -a flag
nflag bool // the -n flag
+ vflag bool // the -v flag
xflag bool // the -x flag
arch string // e.g., "6"
goroot string // the $GOROOT
@@ -190,10 +195,11 @@ const (
modeInstall
)
-func (b *builder) init(aflag, nflag, xflag bool) {
+func (b *builder) init(aflag, nflag, vflag, xflag bool) {
var err error
b.aflag = aflag
b.nflag = nflag
+ b.vflag = vflag
b.xflag = xflag
b.actionCache = make(map[cacheKey]*action)
b.mkdirCache = make(map[string]bool)
@@ -456,6 +462,10 @@ func (b *builder) build(a *action) error {
fmt.Printf("\n#\n# %s\n#\n\n", a.p.ImportPath)
}
+ if b.vflag {
+ fmt.Fprintf(os.Stderr, "%s\n", a.p.ImportPath)
+ }
+
// make build directory
obj := a.objdir
if err := b.mkdir(obj); err != nil {
diff --git a/src/cmd/go/run.go b/src/cmd/go/run.go
index 3ccb465a6..371ba1654 100644
--- a/src/cmd/go/run.go
+++ b/src/cmd/go/run.go
@@ -31,7 +31,7 @@ var runX = cmdRun.Flag.Bool("x", false, "")
func runRun(cmd *Command, args []string) {
var b builder
- b.init(*runA, *runN, *runX)
+ b.init(*runA, *runN, false, *runX)
files, args := splitArgs(args)
p := goFilesPackage(files, "")
p.target = "" // must build - not up to date
diff --git a/src/cmd/go/test.go b/src/cmd/go/test.go
index fb0ba7b4d..e6b70dda4 100644
--- a/src/cmd/go/test.go
+++ b/src/cmd/go/test.go
@@ -220,7 +220,7 @@ func runTest(cmd *Command, args []string) {
}
var b builder
- b.init(false, false, testX)
+ b.init(false, false, false, testX)
var builds, runs []*action
diff --git a/src/make.bash b/src/make.bash
index 10eaade53..db8cd7cd4 100755
--- a/src/make.bash
+++ b/src/make.bash
@@ -96,7 +96,7 @@ if $USE_GO_TOOL; then
./buildscript_${GOOS}_$GOARCH.sh
echo '# Building Go code.'
- go install -a std
+ go install -a -v std
else
echo; echo; echo %%%% making pkg %%%%; echo
gomake -C pkg install
diff --git a/src/run.bash b/src/run.bash
index 004c66eea..2741637a8 100755
--- a/src/run.bash
+++ b/src/run.bash
@@ -34,7 +34,7 @@ if $rebuild; then
if $USE_GO_TOOL; then
echo
echo '# Package builds'
- time go install -a std
+ time go install -a -v std
else
(xcd pkg
gomake clean