From 28b48a35fa57aac0d58c5ffdf4ef4bb045d93368 Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Fri, 18 Nov 2022 08:48:08 -0500 Subject: [PATCH] mktemp -d --- hack/setup-temporary-gopath.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hack/setup-temporary-gopath.sh b/hack/setup-temporary-gopath.sh index 30eefc00f91..f16c051485b 100755 --- a/hack/setup-temporary-gopath.sh +++ b/hack/setup-temporary-gopath.sh @@ -8,7 +8,7 @@ set -o nounset # the current repo directory is not within GOPATH. function shim_gopath() { local REPO_DIR=$(git rev-parse --show-toplevel) - local TEMP_GOPATH="/tmp/.gopath" + local TEMP_GOPATH="$(mktemp -d)/.gopath" local TEMP_TEKTONCD="${TEMP_GOPATH}/src/github.com/tektoncd" local TEMP_PIPELINE="${TEMP_TEKTONCD}/pipeline" local NEEDS_MOVE=1 @@ -40,7 +40,7 @@ function shim_gopath() { mkdir -p "$TEMP_TEKTONCD" # This will create a symlink from - # /tmp/.gopath/src/github.com/tektoncd/pipeline + # $(mktemp -d)/.gopath/src/github.com/tektoncd/pipeline # to the user's pipeline checkout. ln -s "$REPO_DIR" "$TEMP_PIPELINE" echo "Moving to $TEMP_PIPELINE" @@ -59,7 +59,7 @@ function shim_gopath() { # script's execution we just print a message to let them know. function shim_gopath_clean() { local REPO_DIR=$(git rev-parse --show-toplevel) - local TEMP_GOPATH="/tmp/.gopath" + local TEMP_GOPATH="$(mktemp -d)/.gopath" if [ -d "$TEMP_GOPATH" ] ; then # Put the user back at the root of the pipelines repo # after all the symlink shenanigans. @@ -74,7 +74,7 @@ function shim_gopath_clean() { # Delete the temp symlink to pipelines repo from the temp GOPATH dir. function delete_pipeline_repo_symlink() { local REPO_DIR=$(git rev-parse --show-toplevel) - local TEMP_GOPATH="/tmp/.gopath" + local TEMP_GOPATH="$(mktemp -d)/.gopath" if [ -d "$TEMP_GOPATH" ] ; then local REPO_SYMLINK="${TEMP_GOPATH}/src/github.com/tektoncd/pipeline" if [ -L $REPO_SYMLINK ] ; then