diff options
| author | Jeff Carr <[email protected]> | 2024-11-28 18:36:29 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-28 18:36:29 -0600 |
| commit | e43863e8e7307f2e8f882b31b30672ad595b932c (patch) | |
| tree | ce8b702f50e314915d6c67f3c75c6f2b20821245 | |
| parent | 9d13c972e4b36e46b69b45247a3c7dd3f34b3b10 (diff) | |
start refactor to protobuf
| -rw-r--r-- | new.go | 26 |
1 files changed, 11 insertions, 15 deletions
@@ -4,6 +4,7 @@ import ( "os" "strings" + "go.wit.com/lib/protobuf/gitpb" "go.wit.com/lib/gadgets" "go.wit.com/log" ) @@ -31,30 +32,25 @@ func FindPathOld(path string) *RepoStatus { return windowMap[path] } -// makes a window of the status of the repo -// don't worry, you can think of it like Sierpinski carpet -// it's doesn't need to be displayed so it'll work fine even in an embedded space -func New(path string) (*RepoStatus, error) { - err, r := NewRepoStatusWindow(path) - return r, err -} - func SetWorkPath(path string) { os.Setenv("REPO_WORK_PATH", path) } -func NewRepoStatusWindow(path string) (error, *RepoStatus) { - path, realpath, goSrcDir, isGoLang, err := guessPaths(path) - if err != nil { - return err, nil - } +// makes a window of the status of the repo +// don't worry, you can think of it like Sierpinski carpet +// it's doesn't need to be displayed so it'll work fine even in an embedded space +func NewRepoStatusWindow(repo *gitpb.Repo) (*RepoStatus, error) { + path := repo.GoPath + goSrcDir := os.Getenv("FORGE_GOSRC") + realpath := repo.FullPath + isGoLang := true if windowMap[path] == nil { log.Log(INFO, "NewRepoStatusWindow() adding new", path) } else { log.Warn("This already exists for path", path) log.Warn("should return windowMap[path] here") - return nil, windowMap[path] + return windowMap[path], nil } rs := &RepoStatus{ @@ -117,5 +113,5 @@ func NewRepoStatusWindow(path string) (error, *RepoStatus) { rs.goPath.SetText(path) } windowMap[path] = rs - return nil, rs + return rs, nil } |
