From cb04f3585c1abe95f6bddfa282e829896c2bb19a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 7 Dec 2024 16:50:26 -0600 Subject: debugging switching go/src dirs --- repo.new.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'repo.new.go') diff --git a/repo.new.go b/repo.new.go index 9404d7b..9d0f7ba 100644 --- a/repo.new.go +++ b/repo.new.go @@ -19,7 +19,7 @@ func (all *Repos) NewGoPath(basepath string, gopath string, url string) (*Repo, } if r := all.FindByGoPath(gopath); r != nil { // already had this gopath - return nil, errors.New("duplicate gopath " + gopath) + return r, errors.New("gitpb.NewGoPath() duplicate gopath " + gopath) } log.Info("gitpb.NewGoPath() Attempting to add new path", basepath, gopath) @@ -58,7 +58,11 @@ func (all *Repos) NewGoPath(basepath string, gopath string, url string) (*Repo, // worked return &newr, nil } - return nil, errors.New("repo already exists: " + gopath) + if r := all.FindByGoPath(gopath); r != nil { + // already had this gopath + return r, errors.New("gitpb.NewGoPath() AppendUnique() failed but Find() worked" + gopath) + } + return nil, errors.New("repo gitpb.NewGoPath() should never have gotten here " + gopath) } func (repo *Repo) SetDevelBranchName(bname string) { -- cgit v1.2.3