]> Cypherpunks repositories - gostls13.git/commitdiff
misc/dist: include cover and vet, add -tool flag to specify go.tools tag
authorAndrew Gerrand <adg@golang.org>
Fri, 13 Sep 2013 00:28:30 +0000 (10:28 +1000)
committerAndrew Gerrand <adg@golang.org>
Fri, 13 Sep 2013 00:28:30 +0000 (10:28 +1000)
Fixes #6356.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13333052

misc/dist/bindist.go

index ea716ffd6b56a302698208a976d3450ec3686587..c01274d71ab6b7326e7520272e1e4609b1535c78 100644 (file)
@@ -30,6 +30,7 @@ import (
 
 var (
        tag             = flag.String("tag", "release", "mercurial tag to check out")
+       toolTag         = flag.String("tool", defaultToolTag, "go.tools tag to check out")
        repo            = flag.String("repo", "https://code.google.com/p/go", "repo URL")
        verbose         = flag.Bool("v", false, "verbose output")
        upload          = flag.Bool("upload", true, "upload resulting files to Google Code")
@@ -42,11 +43,21 @@ var (
 )
 
 const (
-       uploadURL = "https://go.googlecode.com/files"
-       godocPath = "code.google.com/p/go.tools/cmd/godoc"
-       tourPath  = "code.google.com/p/go-tour"
+       uploadURL      = "https://go.googlecode.com/files"
+       tourPath       = "code.google.com/p/go-tour"
+       toolPath       = "code.google.com/p/go.tools"
+       defaultToolTag = "tip" // TOOD(adg): set this once Go 1.2 settles
 )
 
+// Import paths for tool commands.
+// These must be the command that cmd/go knows to install to $GOROOT/bin
+// or $GOROOT/pkg/tool.
+var toolPaths = []string{
+       "code.google.com/p/go.tools/cmd/cover",
+       "code.google.com/p/go.tools/cmd/godoc",
+       "code.google.com/p/go.tools/cmd/vet",
+}
+
 var preBuildCleanFiles = []string{
        "lib/codereview",
        "misc/dashboard/godashboard",
@@ -75,12 +86,11 @@ var tourPackages = []string{
 }
 
 var tourContent = []string{
+       "content",
        "js",
-       "prog",
        "solutions",
        "static",
        "template",
-       "tour.article",
 }
 
 // The os-arches that support the race toolchain.
@@ -227,7 +237,7 @@ func (b *Build) Do() error {
                if err != nil {
                        return err
                }
-               err = b.godoc()
+               err = b.tools()
                if err != nil {
                        return err
                }
@@ -413,7 +423,7 @@ func (b *Build) Do() error {
        return err
 }
 
-func (b *Build) godoc() error {
+func (b *Build) tools() error {
        defer func() {
                // Clean work files from GOPATH directory.
                for _, d := range []string{"bin", "pkg", "src"} {
@@ -421,9 +431,23 @@ func (b *Build) godoc() error {
                }
        }()
 
-       // go get the godoc package.
-       // The go tool knows to install to $GOROOT/bin.
-       _, err := b.run(b.gopath, filepath.Join(b.root, "bin", "go"), "get", godocPath)
+       // Fetch the tool packages (without building/installing).
+       args := append([]string{"get", "-d"}, toolPaths...)
+       _, err := b.run(b.gopath, filepath.Join(b.root, "bin", "go"), args...)
+       if err != nil {
+               return err
+       }
+
+       // Update the repo to the revision specified by -tool.
+       repoPath := filepath.Join(b.gopath, "src", filepath.FromSlash(toolPath))
+       _, err = b.run(repoPath, "hg", "update", *toolTag)
+       if err != nil {
+               return err
+       }
+
+       // Install tools.
+       args = append([]string{"install"}, toolPaths...)
+       _, err = b.run(b.gopath, filepath.Join(b.root, "bin", "go"), args...)
        return err
 }