@@ -301,10 +301,11 @@ GO_TOOLS="\
301301if [ " ${INSTALL_GO_TOOLS} " = " true" ]; then
302302 echo " Installing common Go tools..."
303303 export PATH=${TARGET_GOROOT} /bin:${PATH}
304- mkdir -p /tmp/gotools /usr/local/etc/vscode-dev-containers ${TARGET_GOPATH} /bin
305- cd /tmp/gotools
306304 export GOPATH=/tmp/gotools
307- export GOCACHE=/tmp/gotools/cache
305+ export GOCACHE=" ${GOPATH} /cache"
306+
307+ mkdir -p " ${GOPATH} " /usr/local/etc/vscode-dev-containers " ${TARGET_GOPATH} /bin"
308+ cd " ${GOPATH} "
308309
309310 # Use go get for versions of go under 1.16
310311 go_install_command=install
@@ -316,10 +317,9 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
316317
317318 (echo " ${GO_TOOLS} " | xargs -n 1 go ${go_install_command} -v )2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
318319
319- # Move Go tools into path and clean up
320- if [ -d /tmp/gotools/bin ]; then
321- mv /tmp/gotools/bin/* ${TARGET_GOPATH} /bin/
322- rm -rf /tmp/gotools
320+ # Move Go tools into path
321+ if [ -d " ${GOPATH} /bin" ]; then
322+ mv " ${GOPATH} /bin" /* " ${TARGET_GOPATH} /bin/"
323323 fi
324324
325325 # Install golangci-lint from precompiled binares
@@ -332,6 +332,9 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
332332 curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \
333333 sh -s -- -b " ${TARGET_GOPATH} /bin" " v${GOLANGCILINT_VERSION} "
334334 fi
335+
336+ # Remove Go tools temp directory
337+ rm -rf " ${GOPATH} "
335338fi
336339
337340
0 commit comments