Skip to content

Commit

Permalink
mktemp -d
Browse files Browse the repository at this point in the history
  • Loading branch information
imjasonh authored and tekton-robot committed Nov 21, 2022
1 parent ca7d470 commit 28b48a3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hack/setup-temporary-gopath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 28b48a3

Please sign in to comment.