summaryrefslogtreecommitdiff
path: root/init.go
diff options
context:
space:
mode:
Diffstat (limited to 'init.go')
-rw-r--r--init.go36
1 files changed, 20 insertions, 16 deletions
diff --git a/init.go b/init.go
index ca40f25..6b7c420 100644
--- a/init.go
+++ b/init.go
@@ -9,6 +9,9 @@ import (
"go.wit.com/log"
)
+// todo: use initOnce
+// cache.go has Do()
+// f.initOnce.Do(f.initWork)
func Init() *Forge {
f := new(Forge)
@@ -37,37 +40,38 @@ func Init() *Forge {
}
// 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)
-
- f.Config = new(ForgeConfigs)
+ log.Info("forgepb.Init() FORGE_CONFIG", os.Getenv("FORGE_CONFIG"))
// load the ~/.config/forge/ config
+ f.Config = new(ForgeConfigs)
if err := f.Config.ConfigLoad(); err != nil {
log.Warn("forgepb.ConfigLoad() failed", err)
os.Exit(-1)
}
+ if f.IsGoWork() {
+ log.Info("forgepb.Init() FORGE_GOSRC ", os.Getenv("FORGE_GOSRC"), "(go.work = true)")
+ } else {
+ log.Info("forgepb.Init() FORGE_GOSRC ", os.Getenv("FORGE_GOSRC"), "(go.work = false)")
+ }
f.Repos = new(gitpb.Repos)
f.Repos.ConfigLoad()
- f.Machine = new(zoopb.Machine)
-
- if err := f.Machine.ConfigLoad(); err != nil {
- log.Warn("zoopb.ConfigLoad() failed", err)
- os.Exit(-1)
- }
- f.Machine.InitWit()
start := f.Repos.Len()
f.ScanGoSrc()
end := f.Repos.Len()
if (end - start) == 0 {
- log.Info("Scan of", f.GetGoSrc(), "did not find new git repositories")
+ log.Info("forgepb.Scan() Scan did not find new git repositories.")
} else {
- log.Info("Scan of", f.GetGoSrc(), "Found", end-start, "new git repositories")
+ log.Info("forgepb.Scan() Scan found", end-start, "new git repositories.")
+ }
+
+ f.Machine = new(zoopb.Machine)
+
+ if err := f.Machine.ConfigLoad(); err != nil {
+ log.Warn("zoopb.ConfigLoad() failed", err)
+ os.Exit(-1)
}
+ f.Machine.InitWit()
return f
}