From: Ian Lance Taylor Date: Thu, 12 Nov 2015 22:57:53 +0000 (-0800) Subject: cmd/dist: check more GOOS/GOARCH combinations in mkdeps.bash X-Git-Tag: go1.6beta1~437 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1860a0fa571ff13ed2c4a23d50d55945720c86bb;p=gostls13.git cmd/dist: check more GOOS/GOARCH combinations in mkdeps.bash 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 TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/dist/mkdeps.bash b/src/cmd/dist/mkdeps.bash index 283d6bff81..78572860ea 100755 --- a/src/cmd/dist/mkdeps.bash +++ b/src/cmd/dist/mkdeps.bash @@ -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