I have this script:
#!/usr/bin/env bash
set -eo pipefail
cd "$(dirname "$BASH_SOURCE")";
pth_to_make="$GOPATH/src/ores/json-logging"
mkdir -p "$pth_to_make";
rm -rf "$pth_to_make";
ln -sf "$PWD" "$pth_to_make";
however this module is not declared as a go module in go.mod...I am symlinking a different dependency into the repo to test it.
The real dependency in production is at:
"$GOPATH/src/github.com/oresoftware/json-logging"
the test path is:
"$GOPATH/src/ores/json-logging"
Now, I would just delete the real dependency path in local development, the problem is that it then just deletes the .git folder in the repo and then I end up having to download that again.
Is there some way for me to symlink over the real repo/dep folder, but not lose the git stuff? Maybe I could do:
mv "$GOPATH/src/github.com/oresoftware/json-logging" "/tmp/gotemp/json-logging"
# call the script above
# then when I am done:
rm -rf "$GOPATH/src/github.com/oresoftware/json-logging"
mv "/tmp/gotemp/json-logging" "$GOPATH/src/github.com/oresoftware/json-logging" # put it back
would that be the best way forward?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…