From 8893af7740e7fa27fc5040242a4f805ea6aa163d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 28 Nov 2024 21:03:23 -0600 Subject: [PATCH] testGui example seems to work --- common.go | 4 ++++ newRepo.go | 11 ++++++----- structs.go | 2 ++ testGui/Makefile | 3 +-- testGui/main.go | 13 +++++++------ 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/common.go b/common.go index fd2edf8..d1ec950 100644 --- a/common.go +++ b/common.go @@ -99,6 +99,10 @@ func (r *RepoRow) IsDirty() bool { return r.Status.IsDirty() } +func (r *RepoRow) RepoType() string { + return r.pb.RepoType() +} + func (r *RepoRow) ReadOnly() bool { if r == nil { log.Warn("ReadOnly() repo == nil") diff --git a/newRepo.go b/newRepo.go index 56002fc..f670edc 100644 --- a/newRepo.go +++ b/newRepo.go @@ -98,25 +98,26 @@ func (r *RepoList) NewRepo(path string) (*RepoRow, error) { */ // adds a gui row to the table based off the repo protobuf -func (r *RepoList) AddRepo(repo *gitpb.Repo) (*RepoRow, error) { - test, ok := r.allrepos[repo.GetGoPath()] +func (r *RepoList) AddRepo(pb *gitpb.Repo) (*RepoRow, error) { + test, ok := r.allrepos[pb.GetGoPath()] if ok { // this repo already exists return test, nil } - status, err := repostatus.NewRepoStatusWindow(repo) + status, err := repostatus.NewRepoStatusWindow(pb) if err != nil { return nil, err } newRepo := new(RepoRow) newRepo.Status = status + newRepo.pb = pb newRepo.Status.InitOk = false - newRepo.pLabel = r.reposgrid.NewLabel(repo.GoPath).SetProgName("path") + newRepo.pLabel = r.reposgrid.NewLabel(pb.GoPath).SetProgName("path") newRepo.hidden = false - r.allrepos[repo.GoPath] = newRepo + r.allrepos[pb.GoPath] = newRepo newRepo.NewScan() switch r.viewName { diff --git a/structs.go b/structs.go index 5b04899..9e33d1a 100644 --- a/structs.go +++ b/structs.go @@ -6,6 +6,7 @@ import ( "go.wit.com/gui" "go.wit.com/lib/gui/repostatus" "go.wit.com/lib/protobuf/forgepb" + "go.wit.com/lib/protobuf/gitpb" ) var me *RepoList @@ -53,6 +54,7 @@ type RepoRow struct { lasttagrev string // lasttag string giturl string + pb *gitpb.Repo pLabel *gui.Node // path label diff --git a/testGui/Makefile b/testGui/Makefile index 24fc00d..74e3039 100644 --- a/testGui/Makefile +++ b/testGui/Makefile @@ -8,7 +8,6 @@ build: reset GO111MODULE=off go build \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" - ./testGui --no-gui --list vet: GO111MODULE=off go vet @@ -34,7 +33,7 @@ redomod: GO111MODULE= go mod init GO111MODULE= go mod tidy -list-packages: +list: ./testGui --no-gui --list pull: build diff --git a/testGui/main.go b/testGui/main.go index 4c55f66..e1a877e 100644 --- a/testGui/main.go +++ b/testGui/main.go @@ -22,12 +22,6 @@ func main() { me.forge = forgepb.Init() me.forge.ConfigPrintTable() - if err := me.forge.Machine.ConfigLoad(); err != nil { - log.Warn("zoopb.ConfigLoad() failed", err) - os.Exit(-1) - } - me.forge.Machine.InitWit() - // setup the GUI me.myGui = gui.New() me.myGui.Default() @@ -42,6 +36,13 @@ func main() { rloop := me.repoList.ReposSortByName() for rloop.Scan() { repo := rloop.Repo() + + repotype := repo.RepoType() + if repotype != "binary" { + // we only want to process golang binaries where package == 'main' + // log.Info("skipping repo", repo.GoPath(), repotype) + continue + } // var cmd []string var start string var end string