version/mkversion: allow env config of oss git cache dir
Updates tailscale/corp#21262 Change-Id: I80bd880b53f6d851c15479f39fad62b25f1095f1 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
ddf94a7b39
commit
da32468988
|
@ -336,11 +336,14 @@ type verInfo struct {
|
|||
const unknownPatchVersion = 9999999
|
||||
|
||||
func infoFromCache(ref string, runner dirRunner) (verInfo, error) {
|
||||
tailscaleCache := os.Getenv("TS_MKVERSION_OSS_GIT_CACHE")
|
||||
if tailscaleCache == "" {
|
||||
cacheDir, err := os.UserCacheDir()
|
||||
if err != nil {
|
||||
return verInfo{}, fmt.Errorf("Getting user cache dir: %w", err)
|
||||
}
|
||||
tailscaleCache := filepath.Join(cacheDir, "tailscale-oss")
|
||||
tailscaleCache = filepath.Join(cacheDir, "tailscale-oss")
|
||||
}
|
||||
r := dirRunner(tailscaleCache)
|
||||
|
||||
if _, err := os.Stat(tailscaleCache); err != nil {
|
||||
|
|
Loading…
Reference in New Issue