new init & config()
This commit is contained in:
parent
b3dc0e265e
commit
8e67e31bbe
|
@ -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
|
||||||
|
}
|
|
@ -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)
|
||||||
|
}
|
5
main.go
5
main.go
|
@ -7,7 +7,10 @@ import (
|
||||||
|
|
||||||
// go will sit here until the window exits
|
// go will sit here until the window exits
|
||||||
func main() {
|
func main() {
|
||||||
forge := forgepb.Init()
|
// read in forge info
|
||||||
|
cfg := configInit()
|
||||||
|
forge := forgepb.InitFromConfig(cfg)
|
||||||
|
|
||||||
all := forge.Repos.SortByFullPath()
|
all := forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
check := all.Next()
|
check := all.Next()
|
||||||
|
|
Loading…
Reference in New Issue