diff --git a/Makefile b/Makefile index 5979905..eb572ba 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,9 @@ -all: +all: goimports @GO111MODULE=off go vet @echo go vet: this go library package builds okay goimports: goimports -w *.go -redomod: clean - GO111MODULE= go mod init - GO111MODULE= go mod tidy - clean: rm -f go.* diff --git a/scan.go b/scan.go index 377ebb1..56c5b23 100644 --- a/scan.go +++ b/scan.go @@ -5,6 +5,7 @@ import ( "strconv" "strings" + "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -41,21 +42,25 @@ func (r *RepoList) ScanRepositories() (int, string) { } func (r *RepoRow) NewScan() int { + return r.NewScan2(r.pb) +} + +func (r *RepoRow) NewScan2(pb *gitpb.Repo) int { var changed int = 0 if r.Status == nil { log.Log(REPOWARN, "repo.Status = nil. not initialized for some reason") return changed } + if pb == nil { + log.Log(REPOWARN, "NewScan() pb = nil") + return changed + } // run the repostatus update r.Status.Update() if r.lastTag != nil { - if r.pb != nil { - r.lastTag.SetLabel(r.pb.GetLastTag()) - } else { - log.Info("r.pb was nil") - } + r.lastTag.SetLabel(pb.GetLastTag()) } if r.masterVersion == nil { @@ -64,9 +69,9 @@ func (r *RepoRow) NewScan() int { if r.pb == nil { panic("what the fuck pb") } - r.masterVersion.SetLabel(r.pb.GetMasterVersion()) - r.develVersion.SetLabel(r.pb.GetDevelVersion()) - r.userVersion.SetLabel(r.pb.GetUserVersion()) + r.masterVersion.SetLabel(pb.GetMasterVersion()) + r.develVersion.SetLabel(pb.GetDevelVersion()) + r.userVersion.SetLabel(pb.GetUserVersion()) r.gitState.SetLabel(r.Status.GitState()) r.currentName.SetLabel(r.Status.GetCurrentBranchName()) r.currentVersion.SetLabel(r.Status.GetCurrentBranchVersion())