summaryrefslogtreecommitdiff
path: root/doForce.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-15 22:34:20 -0600
committerJeff Carr <[email protected]>2024-12-15 22:34:20 -0600
commit3b714282df43c050920c16a47ee7b8ea46f4c350 (patch)
tree37bd03ae61030eec9faf4643631932c619098d23 /doForce.go
parent6392687a6381ce8544b3e50d4083e1391e273849 (diff)
give up and make 3 different versions
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'doForce.go')
-rw-r--r--doForce.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/doForce.go b/doForce.go
new file mode 100644
index 0000000..c2397c4
--- /dev/null
+++ b/doForce.go
@@ -0,0 +1,45 @@
+package main
+
+import (
+ "errors"
+
+ "go.wit.com/lib/protobuf/gitpb"
+ "go.wit.com/log"
+)
+
+// this will make go.mod and go.sum files no matter what
+// thsi will clean out everything and start over
+func doForce(repo *gitpb.Repo) error {
+ // var perfect bool = true
+ if !repo.IsValid() {
+ log.Info(repo.GoPath, "is invalid. fix your repos.pb file with 'forge' first")
+ log.Info("")
+ log.Info("go install go.wit.com/apps/forge@latest")
+ log.Info("")
+ return errors.New(repo.GoPath + " is invalid. fix your repository list with 'forge' first")
+ }
+ log.Info(repo.GoPath, "is valid according to forge")
+
+ // purge the git meta-data if --force
+ repo.Run([]string{"git", "notes", "remove"})
+
+ // erase the go.mod and go.sum files
+ eraseGoMod(repo)
+
+ // actually will re-create go.sum and go.mod now
+ if err := redoGoMod(repo); err != nil {
+ return err
+ }
+
+ // the first time, it'll attempt to fix some stuff
+ cleanGoDepsCheckOk(repo)
+
+ // try to trim junk
+ if err := trimGoSum(repo); err != nil {
+ return err
+ }
+ repo.ParseGoSum()
+
+ configSave = true
+ return nil
+}