blob: 39fe36d46df2713cad0632847f9552dc0d8474d6 [file] [log] [blame]
Devon H. O'Dell553be842009-11-14 15:29:09 -08001#!/usr/bin/env bash
Rob Pike69b74c32008-06-12 13:26:16 -07002# 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 Wedgwood2ef330e2009-12-13 12:27:19 -08006set -e
7
Russ Cox0290d512015-08-05 13:39:07 -04008if [ ! -f run.bash ]; then
9 echo 'clean.bash must be run from $GOROOT/src' 1>&2
10 exit 1
11fi
12export GOROOT="$(cd .. && pwd)"
Mikio Hara0724e5c2012-02-15 23:52:07 +090013
Russ Cox0290d512015-08-05 13:39:07 -040014gobin="${GOBIN:-../bin}"
15if ! "$gobin"/go help >/dev/null 2>&1; then
16 echo 'cannot find go command; nothing to clean' >&2
Christopher Wedgwood2ef330e2009-12-13 12:27:19 -080017 exit 1
18fi
Devon H. O'Dell857d4cf2009-12-11 15:14:09 -080019
Russ Cox0290d512015-08-05 13:39:07 -040020"$gobin/go" clean -i std
21"$gobin/go" tool dist clean
22"$gobin/go" clean -i cmd