tool/gocross: make gocross-wrapper.sh keep multiple Go toolchains around

So it doesn't delete and re-pull when switching between branches.

Updates tailscale/corp#17686

Change-Id: Iffb989781db42fcd673c5f03dbd0ce95972ede0f
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2024-09-17 13:27:05 -07:00
committed by Brad Fitzpatrick
parent 43f4131d7a
commit 6f7e7a30e3
2 changed files with 52 additions and 35 deletions

View File

@@ -55,8 +55,13 @@ func readRevFile(path string) (string, error) {
}
func getToolchain() (toolchainDir, gorootDir string, err error) {
rev, err := toolchainRev()
if err != nil {
return "", "", err
}
cache := filepath.Join(os.Getenv("HOME"), ".cache")
toolchainDir = filepath.Join(cache, "tailscale-go")
toolchainDir = filepath.Join(cache, "tsgo", rev)
gorootDir = filepath.Join(toolchainDir, "gocross-goroot")
// You might wonder why getting the toolchain also provisions and returns a