#!/bin/sh set -eu version_go=1.13 dir_download="$PWD/download" mkdir -p build; cd build dir_install="$PWD/install-go" # Prepare source mkdir -p "go$version_go" tar xf "$dir_download/go$version_go.src.tar.gz" -C "go$version_go" --strip-components 1 cd "go$version_go" # Build and install (cd src; GOROOT_BOOTSTRAP="$PWD/../../install-bootstrap" ./make.bash) rm -rf pkg/obj src/cmd src/builtin find src -type f \( ! -name "*.go" -a ! -name "*.s" -a ! -name "*.h" \) -delete find src -type f \( -name "*_test.go" -o -name "*_test_*.go" \) -delete find src -type d -name "testdata" -exec rm -r {} + find src -type d -empty -delete mkdir -p "$dir_install" cp -at "$dir_install" bin pkg src