github.com/goldbock/go-ethereum@v1.9.7/build/clean_go_build_cache.sh (about)

     1  #!/bin/sh
     2  
     3  # Cleaning the Go cache only makes sense if we actually have Go installed... or
     4  # if Go is actually callable. This does not hold true during deb packaging, so
     5  # we need an explicit check to avoid build failures.
     6  if ! command -v go > /dev/null; then
     7    exit
     8  fi
     9  
    10  version_gt() {
    11    test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"
    12  }
    13  
    14  golang_version=$(go version |cut -d' ' -f3 |sed 's/go//')
    15  
    16  # Clean go build cache when go version is greater than or equal to 1.10
    17  if !(version_gt 1.10 $golang_version); then
    18      go clean -cache
    19  fi