summaryrefslogtreecommitdiff
path: root/init.go
diff options
context:
space:
mode:
Diffstat (limited to 'init.go')
-rw-r--r--init.go23
1 files changed, 10 insertions, 13 deletions
diff --git a/init.go b/init.go
index ac4e092..ca40f25 100644
--- a/init.go
+++ b/init.go
@@ -12,21 +12,17 @@ import (
func Init() *Forge {
f := new(Forge)
- getwd, _ := os.Getwd()
- log.Info("forgepbb.Init() os.Getwd()", getwd)
- log.Info("forgepbb.Init() started with FORGE_CONFIG", os.Getenv("FORGE_CONFIG"))
- log.Info("forgepbb.Init() started with FORGE_GOSRC", os.Getenv("FORGE_GOSRC"))
// TODO: rethink this but it works for now
gosrc := os.Getenv("FORGE_GOSRC")
if gosrc == "" {
goSrcDir, err := f.findGoSrc()
if err != nil {
log.Warn("forge init() findGoSrc()", err)
+ os.Exit(-1)
}
os.Setenv("FORGE_GOSRC", goSrcDir)
}
f.goSrc = os.Getenv("FORGE_GOSRC")
- log.Info("forge.Init() using ~/go/src directory", f.goSrc)
// also rethink this, but maybe this is the right thing to do
if os.Getenv("FORGE_CONFIG") == "" {
@@ -34,12 +30,15 @@ func Init() *Forge {
fullpath := filepath.Join(homeDir, ".config/forge")
os.Setenv("FORGE_CONFIG", fullpath)
}
+
+ // check again for go.work // user could have a go.work file in ~/go/src
if f.goWorkExists() {
f.goWork = true
}
- log.Info("forgepbb.Init() ~/go/src ", f.goSrc)
- log.Info("forgepbb.Init() 2 FORGE_CONFIG", os.Getenv("FORGE_CONFIG"))
- log.Info("forgepbb.Init() 2 FORGE_GOSRC", os.Getenv("FORGE_GOSRC"), "f.goWork =", f.IsGoWork())
+
+ // print out the settings that will be used
+ log.Info("forgepbb.Init() FORGE_CONFIG", os.Getenv("FORGE_CONFIG"))
+ log.Info("forgepbb.Init() FORGE_GOSRC ", os.Getenv("FORGE_GOSRC"), "f.goWork =", f.IsGoWork())
// cache.go has Do()
// f.initOnce.Do(f.initWork)
@@ -65,12 +64,10 @@ func Init() *Forge {
start := f.Repos.Len()
f.ScanGoSrc()
end := f.Repos.Len()
- log.Info("forge.ScanGoSrc() Found", end-start, "new repos in", f.goSrc)
- testenv := os.Getenv("GO111MODULE")
- if testenv == "off" {
- log.Info("GO111MODULE=off", "f.goWork =", f.IsGoWork(), "f.gosrc =", f.GetGoSrc())
+ if (end - start) == 0 {
+ log.Info("Scan of", f.GetGoSrc(), "did not find new git repositories")
} else {
- log.Info("GO111MODULE=", testenv, "f.goWork =", f.IsGoWork(), "f.gosrc =", f.GetGoSrc())
+ log.Info("Scan of", f.GetGoSrc(), "Found", end-start, "new git repositories")
}
return f
}