Fix rm permission errors in local tests#1644
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the local test/bootstrap workflow to avoid repeatedly deleting and recreating the repo-local .gopath, preventing local script/test runs from failing due to permission errors when removing files in .gopath/pkg/mod (notably Go toolchain module contents).
Changes:
- Only recreate
.gopath(and thesrc/github.com/github/gh-ostsymlink) when the expected symlink is missing. - Preserve existing
.gopathacross repeated test runs to avoidrm -rfpermission failures.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| if [ ! -L .gopath/src/github.com/github/gh-ost ]; then | ||
| rm -rf .gopath | ||
| mkdir -p .gopath/src/github.com/github | ||
| ln -s "$PWD" .gopath/src/github.com/github/gh-ost | ||
| fi |
There was a problem hiding this comment.
The guard only checks that .gopath/src/github.com/github/gh-ost is a symlink (-L). If the repo is moved/renamed, an existing symlink can become stale (or point at a different checkout) and this block will be skipped, causing script/test/script/go to cd into the wrong/broken location. Consider also verifying the symlink target matches the current repo path (e.g., compare readlink to $PWD and/or ensure the link target exists) and recreate .gopath when it doesn't.
Do not attempt to recreate the
.gopathsymlink every time tests run. Fixesscript/testfailing locally with numeroustoolchainpermission errors from L14:A more comprehensive fix could remove the symlink setup entirely.