diff --git a/forgeConfig/Makefile b/forgeConfig/Makefile index ecb25d8..afabd5b 100644 --- a/forgeConfig/Makefile +++ b/forgeConfig/Makefile @@ -16,6 +16,9 @@ add: update: ./forgeConfig --update --name 'foo' --gopath 'go.wit.com/apps/foonew' +corruptMemory: + ./forgeConfig --update --name 'foo' --gopath 'blah' + goimports: goimports -w *.go diff --git a/forgeConfig/main.go b/forgeConfig/main.go index 81fe8bc..8e08878 100644 --- a/forgeConfig/main.go +++ b/forgeConfig/main.go @@ -52,13 +52,14 @@ func main() { os.Exit(0) } - testAddRepos(repos) + testMemoryCorruption(repos) repos.ConfigSave() } -func testAddRepos(all *forgepb.Repos) *forgepb.Repos { +// this fucks shit up +func testMemoryCorruption(all *forgepb.Repos) *forgepb.Repos { new1 := new(forgepb.Repo) - new1.Name = "bash" + new1.Name = "bash1" new1.Version = "5.2.21" if all.Append(new1) { log.Info("added", new1.Name, "ok") @@ -67,7 +68,7 @@ func testAddRepos(all *forgepb.Repos) *forgepb.Repos { } new1 = new(forgepb.Repo) - new1.Name = "zookeeper" + new1.Name = "zookeeper1" new1.Debname = "zookeeper-go" if all.Append(new1) { log.Info("added", new1.Name, "ok") diff --git a/update.go b/update.go new file mode 100644 index 0000000..2ad64cf --- /dev/null +++ b/update.go @@ -0,0 +1,11 @@ +package forgepb + +import ( + "os" +) + +func (repos *Repos) UpdateGoPath(r *Repo, gopath string) { + r.Gopath = gopath + repos.ConfigSave() + os.Exit(0) +}