perf: symlink instead of copy all items from specific version to GOROOT #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The gaols here are:
g set <version>
much faster, as it no longer needs to deleteand copy around 400MB / 10,000 files. Instead it just updates 20
symlinks.
rm -rf ...
as that always makes menervous. The old
rm -rf ...
command is still present in the eventthat the target file/folder for the new symlink is a file or folder
instead of a symlink. This is required to enable a seamless upgrade
from the old method of populating GOROOT.
A for loop was needed to iterate over the each binary in the source
version's
bin
folder, as$GOROOT/bin
is now a symlink, the old"$GOROOT/bin/"*
expansion no longer worked correctly.Apologies if this kind of behavior/change has been discussed in the past, I've had a poke around issues and PRs, but couldn't spot anything. Hopefully I'm not blind :)
I should mention that I've only tested this on macOS (Big Sur) for now, but I'm happy to test it on Linux too.