summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-28 18:36:15 -0600
committerJeff Carr <[email protected]>2024-11-28 18:36:15 -0600
commita89dc7f9763c07305f7f73df5e91825f7fc8af1d (patch)
treeefc4ce5be68eb1c0a38601582a31c3524029cf7a
parentc2b7b3c14d2bb0996411675270ef47f795d68229 (diff)
compiles. kinda runs
-rw-r--r--forgeConfig/main.go3
-rw-r--r--init.go13
2 files changed, 7 insertions, 9 deletions
diff --git a/forgeConfig/main.go b/forgeConfig/main.go
index ca958c7..6e9fe1a 100644
--- a/forgeConfig/main.go
+++ b/forgeConfig/main.go
@@ -11,8 +11,7 @@ import (
var VERSION string
func main() {
- var f forgepb.Forge
- f.Init()
+ f := forgepb.Init()
if argv.List {
f.ConfigPrintTable()
diff --git a/init.go b/init.go
index f22d30d..843d869 100644
--- a/init.go
+++ b/init.go
@@ -21,13 +21,10 @@ func init() {
os.Setenv("FORGE_GOSRC", goSrcDir)
}
-func (f *Forge) Init() {
- if f == nil {
- f = new(Forge)
- }
- if f.Config == nil {
- f.Config = new(ForgeConfigs)
- }
+func Init() *Forge {
+ f := new(Forge)
+ f.Config = new(ForgeConfigs)
+
// load the ~/.config/forge/ config
if err := f.Config.ConfigLoad(); err != nil {
log.Warn("forgepb.ConfigLoad() failed", err)
@@ -40,6 +37,8 @@ func (f *Forge) Init() {
f.goSrc = os.Getenv("FORGE_GOSRC")
f.ScanGoSrc()
+ log.Warn("GOT HERE. forge.Init(). f can not be nil")
+ return f
}
func (f *Forge) SortByPath() *ForgeConfigIterator {