diff options
| author | Jeff Carr <[email protected]> | 2025-01-20 07:58:26 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-20 07:58:26 -0600 |
| commit | d8cc97ddb4ba6766b70f17c448de85942bf03f72 (patch) | |
| tree | b7cc71bd6d4684a0b30976a10edd64103ff9eae9 | |
| parent | 66dc174bbac6df66e2bf90d48007089db0428702 (diff) | |
smarter checkingv0.0.34
| -rw-r--r-- | restore.go | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -5,6 +5,7 @@ import ( "os" "path/filepath" + "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -14,11 +15,26 @@ func restoreFromGoPkg(repo *gitpb.Repo) error { if err != nil { badExit(nil, err) } + repo.RunVerboseOnError([]string{"rm", "-f", "go.mod", "go.sum"}) rver := repo.GetLastTag() if rver == "" { return errors.New("could not get master version") } + goget := repo.GetGoPath() + "@" + rver + moddir := filepath.Join(homedir, "go/pkg/mod", repo.GetGoPath()+"@"+rver) + if shell.IsDir(moddir) { + // things are ok + } else { + return errors.New("must run go get " + goget) + } + modfile := filepath.Join(homedir, "go/pkg/mod", repo.GetGoPath()+"@"+rver, "go.mod") + if shell.Exists(modfile) { + // go.mod exists + } else { + // nothing to do. this repo does not have a go.mod file + return nil + } log.Info("mod path should be", modfile) data, err := os.ReadFile(modfile) if err != nil { |
