]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: Dedup package arguments before building.
authorDaniel Morsing <daniel.morsing@gmail.com>
Wed, 17 Oct 2012 15:23:47 +0000 (17:23 +0200)
committerDaniel Morsing <daniel.morsing@gmail.com>
Wed, 17 Oct 2012 15:23:47 +0000 (17:23 +0200)
Fixes #4104.

R=golang-dev, dave, minux.ma
CC=golang-dev
https://golang.org/cl/6639051

src/cmd/go/pkg.go
src/cmd/go/test.bash

index 307bd74cf171a7c22a288f3d1f763ac371fd8fd1..345d8fb54bc15a8176c2afbb6e2e7692df351850 100644 (file)
@@ -671,7 +671,12 @@ func packagesAndErrors(args []string) []*Package {
        args = importPaths(args)
        var pkgs []*Package
        var stk importStack
+       var set = make(map[string]bool)
+
        for _, arg := range args {
+               set[arg] = true
+       }
+       for arg := range set {
                pkgs = append(pkgs, loadPackage(arg, &stk))
        }
 
index 82cbd389cfcaf39f020ca88e0ae83a6f31202f9a..e88610cfe83f5d10f7c0f3a94a83e12f5b54382d 100755 (executable)
@@ -136,6 +136,12 @@ if GOPATH=:$(pwd)/testdata:. ./testgo build go-cmd-test; then
     ok=false
 fi
 
+# issue 4104
+if [ $(./testgo test fmt fmt fmt fmt fmt | wc -l) -ne 1 ] ; then
+    echo 'go test fmt fmt fmt fmt fmt tested the same package multiple times'
+    ok=false
+fi
+
 if $ok; then
        echo PASS
 else