summaryrefslogtreecommitdiff
path: root/update.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-20 15:57:34 -0600
committerJeff Carr <[email protected]>2024-11-20 15:57:34 -0600
commit704d06ba87ac8bc4af4abc1ed88efed82df7127d (patch)
tree57c9fed02e508c51b50cb046e9fae3662f0e02a0 /update.go
parentf1c2695662ea01e05271505e7d5c49f8590b7ff7 (diff)
UpdateGoPath() (probably without memory corruption)
Diffstat (limited to 'update.go')
-rw-r--r--update.go16
1 files changed, 9 insertions, 7 deletions
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)
}