return the error

This commit is contained in:
Jeff Carr 2024-02-18 07:25:48 -06:00
parent 4d1301288e
commit 6a6ebf78b8
1 changed files with 5 additions and 5 deletions

10
new.go
View File

@ -30,13 +30,13 @@ func FindPath(path string) *RepoStatus {
return windowMap[path] return windowMap[path]
} }
func NewRepoStatusWindow(path string) *RepoStatus { func NewRepoStatusWindow(path string) (error, *RepoStatus) {
if windowMap[path] == nil { if windowMap[path] == nil {
log.Log(INFO, "NewRepoStatusWindow() adding new", path) log.Log(INFO, "NewRepoStatusWindow() adding new", path)
} else { } else {
log.Warn("This already exists yet for path", path) log.Warn("This already exists yet for path", path)
log.Warn("should return windowMap[path] here") log.Warn("should return windowMap[path] here")
return windowMap[path] return nil, windowMap[path]
} }
var realpath string var realpath string
@ -44,7 +44,7 @@ func NewRepoStatusWindow(path string) *RepoStatus {
homeDir, err := os.UserHomeDir() homeDir, err := os.UserHomeDir()
if err != nil { if err != nil {
log.Log(WARN, "Error getting home directory:", err) log.Log(WARN, "Error getting home directory:", err)
return nil return err, nil
} }
goSrcDir := filepath.Join(homeDir, "go/src") goSrcDir := filepath.Join(homeDir, "go/src")
@ -65,7 +65,7 @@ func NewRepoStatusWindow(path string) *RepoStatus {
if err != nil { if err != nil {
// log.Log(WARN, "Error reading .git/config:", filename, err) // log.Log(WARN, "Error reading .git/config:", filename, err)
// log.Log(WARN, "TODO: find .git/config in parent directory") // log.Log(WARN, "TODO: find .git/config in parent directory")
return nil return err, nil
} }
rs := &RepoStatus{ rs := &RepoStatus{
@ -122,5 +122,5 @@ func NewRepoStatusWindow(path string) *RepoStatus {
rs.setUserWorkingName() rs.setUserWorkingName()
windowMap[path] = rs windowMap[path] = rs
return rs return nil, rs
} }