new init() and config()
This commit is contained in:
parent
735bfd8122
commit
c638819b00
|
@ -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)
|
||||||
|
}
|
12
main.go
12
main.go
|
@ -38,19 +38,13 @@ func main() {
|
||||||
if argv.Hostname != "" {
|
if argv.Hostname != "" {
|
||||||
HOSTNAME = argv.Hostname
|
HOSTNAME = argv.Hostname
|
||||||
}
|
}
|
||||||
forge = forgepb.Init()
|
|
||||||
|
|
||||||
gitMap = make(map[string]*gitpb.Repo)
|
gitMap = make(map[string]*gitpb.Repo)
|
||||||
repoMap = make(map[string]string)
|
repoMap = make(map[string]string)
|
||||||
|
|
||||||
/*
|
// read in forge info
|
||||||
all := forge.Repos.SortByGoPath()
|
cfg := configInit()
|
||||||
for all.Scan() {
|
forge = forgepb.InitFromConfig(cfg)
|
||||||
repo := all.Next()
|
|
||||||
|
|
||||||
log.Info("forge protobuf has:", repo.GoPath)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// parse the repomap file
|
// parse the repomap file
|
||||||
readRepomap()
|
readRepomap()
|
||||||
|
|
Loading…
Reference in New Issue