]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: check more GOOS/GOARCH combinations in mkdeps.bash
authorIan Lance Taylor <iant@golang.org>
Thu, 12 Nov 2015 22:57:53 +0000 (14:57 -0800)
committerIan Lance Taylor <iant@golang.org>
Mon, 16 Nov 2015 18:34:48 +0000 (18:34 +0000)
The current mkdeps.bash just checks for dependencies for GOOS=windows
with the current GOARCH.  This is not always accurate as some package
imports only happen on specific GOOS/GOARCH combinations.  Check a
selected, easily changed, combination of GOOS/GOARCH values.

This generates a deps.go identical to the one in the repository today.

Fixes #13221.

Change-Id: I96d67d49c8c63641d578acedbb28be807607db65
Reviewed-on: https://go-review.googlesource.com/16882
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/dist/mkdeps.bash

index 283d6bff819ea167374032278044a972573a6f1d..78572860eaa72ec865b086274df2f105ac9298b4 100755 (executable)
@@ -1,8 +1,26 @@
 #!/bin/bash
+# Copyright 2015 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
 
 set -e
 
-# Windows has the most dependencies.
+declare -A alldeps
+
+# We need to test enough GOOS/GOARCH combinations to pick up all the
+# package dependencies.
+gooslist="windows linux darwin solaris"
+goarchlist="386 amd64 arm arm64 ppc64"
+
+for goos in $gooslist; do
+  for goarch in $goarchlist; do
+    deps=$(GOOS=$goos GOARCH=$goarch go list -tags cmd_go_bootstrap -f '{{join .Deps "\n"}}' cmd/go | grep -v '^unsafe$')
+    for dep in $deps cmd/go; do
+      alldeps[$dep]="${alldeps[$dep]} $(GOOS=$goos GOARCH=$goarch go list -tags cmd_go_bootstrap -f '{{range .Deps}}{{if not (eq . "unsafe")}}{{print .}} {{end}}{{end}}' $dep)"
+    done
+  done
+done
+
 export GOOS=windows
 
 (
@@ -12,8 +30,15 @@ export GOOS=windows
        echo
        echo 'var builddeps = map[string][]string{'
 
-       deps=$(GOOS=windows go list -tags cmd_go_bootstrap -f '{{join .Deps "\n"}}' cmd/go | grep -v '^unsafe$')
-       GOOS=windows go list -tags cmd_go_bootstrap -f '{{printf "%q" .ImportPath}}: { {{range .Deps}}{{if not (eq . "unsafe")}}{{printf "%q" .}}, {{end}}{{end}} },' $deps cmd/go
+       for dep in $(for dep in ${!alldeps[@]}; do echo $dep; done | grep -v '^cmd/go$' | sort) cmd/go; do
+         echo -n '"'$dep'"': {
+         for subdep in ${alldeps[$dep]}; do
+           echo $subdep
+         done | sort -u | while read subdep; do
+           echo -n '"'$subdep'"',
+         done
+         echo },
+       done
 
        echo '}'
 ) |gofmt >deps.go