clean.bash raw

   1  #!/usr/bin/env bash
   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  
   6  set -e
   7  
   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)"
  13  
  14  gobin="${GOROOT}"/bin
  15  if ! "$gobin"/go help >/dev/null 2>&1; then
  16  	echo 'cannot find go command; nothing to clean' >&2
  17  	exit 1
  18  fi
  19  
  20  "$gobin/go" clean -i std
  21  "$gobin/go" tool dist clean
  22  "$gobin/go" clean -i cmd
  23