1
0
mirror of https://github.com/golang/go synced 2024-09-30 04:34:33 -06:00

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 <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2015-11-12 14:57:53 -08:00
parent f7c7ed7c41
commit 1860a0fa57

View File

@ -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