Skip to content

Fix rm permission errors in local tests#1644

Open
grodowski wants to merge 1 commit intogithub:masterfrom
Shopify:fix-dev-test
Open

Fix rm permission errors in local tests#1644
grodowski wants to merge 1 commit intogithub:masterfrom
Shopify:fix-dev-test

Conversation

@grodowski
Copy link
Contributor

Do not attempt to recreate the .gopath symlink every time tests run. Fixes script/test failing locally with numerous toolchain permission errors from L14:

rm: cannot remove '.gopath/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.0.darwin-arm64/src/debug/buildinfo/testdata/go117/go117.base64': Permission denied

A more comprehensive fix could remove the symlink setup entirely.

Copilot AI review requested due to automatic review settings March 11, 2026 08:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 the src/github.com/github/gh-ost symlink) when the expected symlink is missing.
  • Preserve existing .gopath across repeated test runs to avoid rm -rf permission 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.

Comment on lines +14 to +18
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
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants