compiles. kinda runs

This commit is contained in:
Jeff Carr 2024-11-28 18:36:15 -06:00
parent c2b7b3c14d
commit a89dc7f976
2 changed files with 7 additions and 9 deletions

View File

@ -11,8 +11,7 @@ import (
var VERSION string var VERSION string
func main() { func main() {
var f forgepb.Forge f := forgepb.Init()
f.Init()
if argv.List { if argv.List {
f.ConfigPrintTable() f.ConfigPrintTable()

11
init.go
View File

@ -21,13 +21,10 @@ func init() {
os.Setenv("FORGE_GOSRC", goSrcDir) os.Setenv("FORGE_GOSRC", goSrcDir)
} }
func (f *Forge) Init() { func Init() *Forge {
if f == nil { f := new(Forge)
f = new(Forge)
}
if f.Config == nil {
f.Config = new(ForgeConfigs) f.Config = new(ForgeConfigs)
}
// load the ~/.config/forge/ config // load the ~/.config/forge/ config
if err := f.Config.ConfigLoad(); err != nil { if err := f.Config.ConfigLoad(); err != nil {
log.Warn("forgepb.ConfigLoad() failed", err) log.Warn("forgepb.ConfigLoad() failed", err)
@ -40,6 +37,8 @@ func (f *Forge) Init() {
f.goSrc = os.Getenv("FORGE_GOSRC") f.goSrc = os.Getenv("FORGE_GOSRC")
f.ScanGoSrc() f.ScanGoSrc()
log.Warn("GOT HERE. forge.Init(). f can not be nil")
return f
} }
func (f *Forge) SortByPath() *ForgeConfigIterator { func (f *Forge) SortByPath() *ForgeConfigIterator {