cmd/toolstash: use 'go tool dist list' to get platforms

This fixes several issues:

* The ls sed hackery generates GOARCH values mipsx and mipsxle,
  instead of mips, mips64, mipsle, and mips64le.
* It removes the dependence on the 9 command.
* It marginally increases readability.

Change-Id: Ie46abc289c2c9923eed693dcf1194f4fd3ea9bd2
Reviewed-on: https://go-review.googlesource.com/38347
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Josh Bleecher Snyder 2017-03-18 22:44:30 -07:00
parent 81dff79736
commit 322b9d710a
1 changed files with 5 additions and 2 deletions

View File

@ -37,9 +37,12 @@ if [ "$pattern" = "" ]; then
pattern=.
fi
targets="$(go tool dist list; echo linux/386/387)"
targets="$(echo "$targets" | tr '/' '-' | sort | egrep "$pattern" | egrep -v 'android-arm|darwin-arm')"
# put linux, nacl first in the target list to get all the architectures up front.
targets="$((ls runtime | 9 sed -n 's/^rt0_(.*)_(.*)\.s/\1-\2/p'; echo linux-386-387) | sort | egrep -v android-arm | egrep "$pattern" | egrep 'linux|nacl')
$(ls runtime | 9 sed -n 's/^rt0_(.*)_(.*)\.s/\1-\2/p' | egrep -v 'android-arm|darwin-arm' | egrep "$pattern" | egrep -v 'linux|nacl')"
targets="$(echo "$targets" | egrep 'linux|nacl') $(echo "$targets" | egrep -v 'linux|nacl')"
if [ "$sete" = true ]; then
set -e
fi