summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-11 03:36:40 -0500
committerJeff Carr <[email protected]>2025-09-11 03:36:40 -0500
commitc638819b0036c496b76a4d530e8add3f3c8ff58a (patch)
tree5ff58e490ad8f745338bef13ef10f0cd1e4d94d8
parent735bfd81223430b900d996b30c22b82b8e3a1146 (diff)
new init() and config()
-rw-r--r--config.go19
-rw-r--r--exit.go18
-rw-r--r--main.go12
3 files changed, 40 insertions, 9 deletions
diff --git a/config.go b/config.go
new file mode 100644
index 0000000..24f047a
--- /dev/null
+++ b/config.go
@@ -0,0 +1,19 @@
+package main
+
+import (
+ "go.wit.com/lib/config"
+ "go.wit.com/lib/protobuf/forgepb"
+ "go.wit.com/log"
+)
+
+// sent via -ldflags
+
+func configInit() *forgepb.ForgeConfigs {
+ configs := new(forgepb.ForgeConfigs)
+ err := config.ConfigLoad(configs, "forge", "forge")
+ if err != nil {
+ log.Info("This tool requires your repos be scanned by forge first")
+ badExit(err)
+ }
+ return configs
+}
diff --git a/exit.go b/exit.go
new file mode 100644
index 0000000..151a176
--- /dev/null
+++ b/exit.go
@@ -0,0 +1,18 @@
+package main
+
+import (
+ "os"
+
+ "go.wit.com/log"
+)
+
+func okExit(thing string) {
+ log.Info(thing, "ok")
+ // log.Info("Finished go-clean on", check.GetGoPath(), "ok")
+ os.Exit(0)
+}
+
+func badExit(err error) {
+ log.Info("go-gui-toolkits failed: ", err)
+ os.Exit(-1)
+}
diff --git a/main.go b/main.go
index df3b3ef..5466d99 100644
--- a/main.go
+++ b/main.go
@@ -38,19 +38,13 @@ func main() {
if argv.Hostname != "" {
HOSTNAME = argv.Hostname
}
- forge = forgepb.Init()
gitMap = make(map[string]*gitpb.Repo)
repoMap = make(map[string]string)
- /*
- all := forge.Repos.SortByGoPath()
- for all.Scan() {
- repo := all.Next()
-
- log.Info("forge protobuf has:", repo.GoPath)
- }
- */
+ // read in forge info
+ cfg := configInit()
+ forge = forgepb.InitFromConfig(cfg)
// parse the repomap file
readRepomap()