From 704d06ba87ac8bc4af4abc1ed88efed82df7127d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 20 Nov 2024 15:57:34 -0600 Subject: UpdateGoPath() (probably without memory corruption) --- update.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'update.go') diff --git a/update.go b/update.go index 2ad64cf..f1f1af3 100644 --- a/update.go +++ b/update.go @@ -1,11 +1,13 @@ package forgepb -import ( - "os" -) +func (all *Repos) UpdateGoPath(name string, gopath string) bool { + oldr := all.DeleteByName(name) + if oldr == nil { + // nothing to update + return false + } -func (repos *Repos) UpdateGoPath(r *Repo, gopath string) { - r.Gopath = gopath - repos.ConfigSave() - os.Exit(0) + // update gopath and append it back to the list + oldr.GoPath = gopath + return all.Append(oldr) } -- cgit v1.2.3