summaryrefslogtreecommitdiff
path: root/goDep.redoGoMod.go
diff options
context:
space:
mode:
Diffstat (limited to 'goDep.redoGoMod.go')
-rw-r--r--goDep.redoGoMod.go47
1 files changed, 32 insertions, 15 deletions
diff --git a/goDep.redoGoMod.go b/goDep.redoGoMod.go
index 82d5830..59845af 100644
--- a/goDep.redoGoMod.go
+++ b/goDep.redoGoMod.go
@@ -7,29 +7,46 @@ import (
"time"
)
-// checks to see if the go.sum and go.mod files
-// match the repo.pb information
+// checks to see if the go.sum and go.mod files exist
+// also check for a match with the repo.pb GoPrimitive bool
+// todo: check mtime
func (repo *Repo) ValidGoSum() error {
+ if !repo.Exists("go.mod") {
+ return errors.New("ValidGoSum() go.mod is missing")
+ }
if repo.GoPrimitive {
+ if !repo.Exists("go.mod") {
+ return errors.New("GoPrimitive == true, but go.mod is missing")
+ }
// repo thinks it is primitive but has a go.sum file
if repo.Exists("go.sum") {
return errors.New("GoPrimitive == true, but go.sum exists")
}
- mtime, err := repo.mtime("go.mod")
- if err == nil {
- return err
- }
- if mtime != repo.LastGoDep.AsTime() {
- return errors.New("go.mod mtime mis-match")
- }
- }
- mtime, err := repo.mtime("go.sum")
- if err == nil {
- return err
+ /*
+ // todo: fix this
+ mtime, err := repo.mtime("go.mod")
+ if err == nil {
+ return err
+ }
+ if mtime != repo.LastGoDep.AsTime() {
+ return errors.New("go.mod mtime mis-match")
+ }
+ */
+ return nil
}
- if mtime != repo.LastGoDep.AsTime() {
- return errors.New("go.sum mtime mis-match")
+ if !repo.Exists("go.sum") {
+ return errors.New("ValidGoSum() go.sum is missing")
}
+ /*
+ mtime, err := repo.mtime("go.sum")
+ // todo: fix this
+ if err == nil {
+ return err
+ }
+ if mtime != repo.LastGoDep.AsTime() {
+ return errors.New("go.sum mtime mis-match")
+ }
+ */
return nil
}