rm GOSRC
This commit is contained in:
parent
c5780cc333
commit
2add723f12
|
@ -36,7 +36,6 @@ func ConfigureENV() error {
|
||||||
log.Printf("FORGE_REPOPB = %s\n", os.Getenv("FORGE_REPOPB"))
|
log.Printf("FORGE_REPOPB = %s\n", os.Getenv("FORGE_REPOPB"))
|
||||||
log.Printf("FORGE_PATCHDIR = %s\n", os.Getenv("FORGE_PATCHDIR"))
|
log.Printf("FORGE_PATCHDIR = %s\n", os.Getenv("FORGE_PATCHDIR"))
|
||||||
log.Printf("FORGE_URL = %s\n", os.Getenv("FORGE_URL"))
|
log.Printf("FORGE_URL = %s\n", os.Getenv("FORGE_URL"))
|
||||||
log.Printf("FORGE_GOSRC = %s\n", os.Getenv("FORGE_GOSRC"))
|
|
||||||
log.Printf("FORGE_GOWORK = %v\n", os.Getenv("FORGE_GOWORK"))
|
log.Printf("FORGE_GOWORK = %v\n", os.Getenv("FORGE_GOWORK"))
|
||||||
log.Printf("FORGE_VERBOSE = %s\n", os.Getenv("FORGE_VERBOSE"))
|
log.Printf("FORGE_VERBOSE = %s\n", os.Getenv("FORGE_VERBOSE"))
|
||||||
log.Printf("HOSTNAME = %s\n", os.Getenv("HOSTNAME"))
|
log.Printf("HOSTNAME = %s\n", os.Getenv("HOSTNAME"))
|
||||||
|
@ -75,65 +74,6 @@ func doConfigureENV() error {
|
||||||
os.Setenv("HOSTNAME", "unconfigured.hostname.forge")
|
os.Setenv("HOSTNAME", "unconfigured.hostname.forge")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this env is already set, just use what is there
|
|
||||||
if os.Getenv("FORGE_GOSRC") != "" {
|
|
||||||
// always use this ENV if it is set
|
|
||||||
os.Setenv("FORGE_REPOPB", os.Getenv("FORGE_GOSRC")) // store repos.pb in the same dir
|
|
||||||
if goWorkExists(os.Getenv("FORGE_GOSRC")) {
|
|
||||||
os.Setenv("FORGE_GOWORK", "true")
|
|
||||||
}
|
|
||||||
if os.Getenv("FORGE_PATCHDIR") == "" {
|
|
||||||
os.Setenv("FORGE_PATCHDIR", os.Getenv("FORGE_GOSRC"))
|
|
||||||
}
|
|
||||||
return anyerr
|
|
||||||
}
|
|
||||||
|
|
||||||
// if a go.work file is found, use that location
|
|
||||||
if gowork, ok := findGoWork(); ok {
|
|
||||||
os.Setenv("FORGE_GOSRC", gowork)
|
|
||||||
if os.Getenv("FORGE_GOSRC") == "" {
|
|
||||||
// everything went wrong. use /tmp maybe ?
|
|
||||||
os.Setenv("FORGE_GOSRC", "/tmp")
|
|
||||||
}
|
|
||||||
os.Setenv("FORGE_REPOPB", os.Getenv("FORGE_GOSRC")) // store repos.pb in the same dir
|
|
||||||
os.Setenv("FORGE_GOWORK", "true")
|
|
||||||
if os.Getenv("FORGE_PATCHDIR") == "" {
|
|
||||||
os.Setenv("FORGE_PATCHDIR", os.Getenv("FORGE_GOSRC"))
|
|
||||||
}
|
|
||||||
return anyerr
|
|
||||||
} else {
|
|
||||||
// log.Info("fhelp.findGoWork() didn't find a go.work file")
|
|
||||||
}
|
|
||||||
|
|
||||||
// there are no go.work files, use the default ~/go/src behavior
|
|
||||||
if gosrc, err := useGoSrc(); err == nil {
|
|
||||||
os.Setenv("FORGE_GOSRC", gosrc)
|
|
||||||
os.Unsetenv("FORGE_GOWORK")
|
|
||||||
}
|
|
||||||
|
|
||||||
// set to user home dir unless this is already set
|
|
||||||
if os.Getenv("FORGE_REPOPB") == "" {
|
|
||||||
homeDir, err := os.UserHomeDir()
|
|
||||||
if err == nil {
|
|
||||||
fullpath := filepath.Join(homeDir, ".cache/forge")
|
|
||||||
if err := os.MkdirAll(fullpath, os.ModePerm); err == nil {
|
|
||||||
os.Setenv("FORGE_REPOPB", fullpath)
|
|
||||||
} else {
|
|
||||||
log.Warn("mkdir failed", fullpath, err)
|
|
||||||
os.Setenv("FORGE_REPOPB", os.Getenv("FORGE_GOSRC")) // store repos.pb in the same dir
|
|
||||||
anyerr = err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.Info("user home dir error", err)
|
|
||||||
os.Setenv("FORGE_REPOPB", "/tmp")
|
|
||||||
anyerr = err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if os.Getenv("FORGE_PATCHDIR") == "" {
|
|
||||||
os.Setenv("FORGE_PATCHDIR", os.Getenv("FORGE_REPOPB"))
|
|
||||||
}
|
|
||||||
|
|
||||||
return anyerr
|
return anyerr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue