diff --git a/new.go b/new.go index 729a52e..2f81b9c 100644 --- a/new.go +++ b/new.go @@ -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 }