Devon H. O'Dell | 553be84 | 2009-11-14 15:29:09 -0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Rob Pike | 69b74c3 | 2008-06-12 13:26:16 -0700 | [diff] [blame] | 2 | # Copyright 2009 The Go Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style |
| 4 | # license that can be found in the LICENSE file. |
| 5 | |
Christopher Wedgwood | 2ef330e | 2009-12-13 12:27:19 -0800 | [diff] [blame] | 6 | set -e |
| 7 | |
Russ Cox | 0290d51 | 2015-08-05 13:39:07 -0400 | [diff] [blame] | 8 | if [ ! -f run.bash ]; then |
| 9 | echo 'clean.bash must be run from $GOROOT/src' 1>&2 |
| 10 | exit 1 |
| 11 | fi |
| 12 | export GOROOT="$(cd .. && pwd)" |
Mikio Hara | 0724e5c | 2012-02-15 23:52:07 +0900 | [diff] [blame] | 13 | |
Russ Cox | 0290d51 | 2015-08-05 13:39:07 -0400 | [diff] [blame] | 14 | gobin="${GOBIN:-../bin}" |
| 15 | if ! "$gobin"/go help >/dev/null 2>&1; then |
| 16 | echo 'cannot find go command; nothing to clean' >&2 |
Christopher Wedgwood | 2ef330e | 2009-12-13 12:27:19 -0800 | [diff] [blame] | 17 | exit 1 |
| 18 | fi |
Devon H. O'Dell | 857d4cf | 2009-12-11 15:14:09 -0800 | [diff] [blame] | 19 | |
Russ Cox | 0290d51 | 2015-08-05 13:39:07 -0400 | [diff] [blame] | 20 | "$gobin/go" clean -i std |
| 21 | "$gobin/go" tool dist clean |
| 22 | "$gobin/go" clean -i cmd |