summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-20 13:43:26 -0600
committerJeff Carr <[email protected]>2024-11-20 13:43:26 -0600
commit09f855910c9c5ebf146bd6ff1b00e911f7b850d5 (patch)
tree63aa9a027eb4205eca8afdfa152609e26e8a5634
parente14bc69169643c7f3eb3e31447657a877716eda4 (diff)
exposes memory corruption. need to fix
-rw-r--r--forgeConfig/Makefile3
-rw-r--r--forgeConfig/argv.go1
-rw-r--r--forgeConfig/main.go12
3 files changed, 15 insertions, 1 deletions
diff --git a/forgeConfig/Makefile b/forgeConfig/Makefile
index 8c6325d..ecb25d8 100644
--- a/forgeConfig/Makefile
+++ b/forgeConfig/Makefile
@@ -13,6 +13,9 @@ list:
add:
./forgeConfig --add --name 'foo' --gopath 'go.wit.com/apps/foo'
+update:
+ ./forgeConfig --update --name 'foo' --gopath 'go.wit.com/apps/foonew'
+
goimports:
goimports -w *.go
diff --git a/forgeConfig/argv.go b/forgeConfig/argv.go
index 44aff23..9081e9e 100644
--- a/forgeConfig/argv.go
+++ b/forgeConfig/argv.go
@@ -12,6 +12,7 @@ type args struct {
ConfigDir string `arg:"env:FORGE_HOME" help:"defaults to ~/.config/forge/"`
List bool `arg:"--list" default:"false" help:"list repos in your config"`
Add bool `arg:"--add" default:"false" help:"add a new repo"`
+ Update bool `arg:"--update" default:"false" help:"update a repo"`
Name string `arg:"--name" help:"name of the repo"`
GoPath string `arg:"--gopath" help:"gopath of the repo"`
}
diff --git a/forgeConfig/main.go b/forgeConfig/main.go
index cdd70cf..81fe8bc 100644
--- a/forgeConfig/main.go
+++ b/forgeConfig/main.go
@@ -20,13 +20,23 @@ func main() {
}
if argv.List {
log.Info(forgepb.RepoHeader())
- loop := repos.SortByName() // get the list of droplets
+ loop := repos.SortByName() // get the list of repos
for loop.Scan() {
r := loop.Repo()
log.Info("repo:", r.Name, r.Gopath)
}
os.Exit(0)
}
+ if argv.Update {
+ r := repos.FindByName(argv.Name) // find the repo
+ if r == nil {
+ log.Info("rep:", argv.Name, "not found")
+ os.Exit(-1)
+ }
+ r.Gopath = argv.GoPath
+ repos.ConfigSave()
+ os.Exit(0)
+ }
if argv.Add {
log.Info("going to add a new repo", argv.Name, argv.GoPath)
new1 := new(forgepb.Repo)