From 2add723f12816f41571d7848e3aede17a08cae11 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 11 Sep 2025 23:10:33 -0500 Subject: [PATCH] rm GOSRC --- configureENV.go | 60 ------------------------------------------------- 1 file changed, 60 deletions(-) diff --git a/configureENV.go b/configureENV.go index a03d050..31973e2 100644 --- a/configureENV.go +++ b/configureENV.go @@ -36,7 +36,6 @@ func ConfigureENV() error { log.Printf("FORGE_REPOPB = %s\n", os.Getenv("FORGE_REPOPB")) log.Printf("FORGE_PATCHDIR = %s\n", os.Getenv("FORGE_PATCHDIR")) 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_VERBOSE = %s\n", os.Getenv("FORGE_VERBOSE")) log.Printf("HOSTNAME = %s\n", os.Getenv("HOSTNAME")) @@ -75,65 +74,6 @@ func doConfigureENV() error { 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 }