diff options
| -rw-r--r-- | goSrcScan.go | 9 | ||||
| -rw-r--r-- | init.go | 36 |
2 files changed, 25 insertions, 20 deletions
diff --git a/goSrcScan.go b/goSrcScan.go index 6670259..5599c46 100644 --- a/goSrcScan.go +++ b/goSrcScan.go @@ -51,7 +51,6 @@ func (f *Forge) ScanGoSrc() (bool, error) { func gitDirectoriesNew(srcDir string) ([]string, error) { var all []string var trip bool - reposfile := filepath.Join(srcDir, "repos.pb") err := filepath.WalkDir(srcDir, func(path string, d os.DirEntry, err error) error { if err != nil { // Handle possible errors, like permission issues @@ -62,9 +61,11 @@ func gitDirectoriesNew(srcDir string) ([]string, error) { if d.IsDir() { // log.Info("path is dir", path) } else { - if path == reposfile { - // ignore repos.pb // todo: also ignore go.work // add config option to not warn about this - } else { + _, fname := filepath.Split(path) + switch fname { + case "repos.pb": + case "go.work": + default: // todo: figure out a way to do padding for init() log.Info("WARNING: you have an untracked file outside of any .git repository:", path) trip = true @@ -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 } |
