rm duplicate code
This commit is contained in:
parent
9935f45bd4
commit
328fbe9fdd
|
@ -1,52 +1,22 @@
|
||||||
package gitpb
|
package gitpb
|
||||||
|
|
||||||
// does processing on the go.mod and go.sum files
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"fmt"
|
||||||
|
|
||||||
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// does processing on the go.mod and go.sum files
|
||||||
|
|
||||||
// checks to see if the go.sum and go.mod files exist
|
// checks to see if the go.sum and go.mod files exist
|
||||||
// also check for a match with the repo.pb GoPrimitive bool
|
// also check for a match with the repo.pb GoPrimitive bool
|
||||||
// todo: check mtime
|
// todo: check mtime
|
||||||
func (repo *Repo) ValidGoSum() error {
|
func (repo *Repo) ValidGoSum() error {
|
||||||
if !repo.Exists("go.mod") {
|
if repo.ParseGoSum() {
|
||||||
return errors.New("ValidGoSum() go.mod is missing")
|
|
||||||
}
|
|
||||||
if repo.GoInfo.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")
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
// 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
|
return nil
|
||||||
}
|
}
|
||||||
if !repo.Exists("go.sum") {
|
log.Info("ValidGoSum() deprecated")
|
||||||
return errors.New("ValidGoSum() go.sum is missing")
|
return fmt.Errorf("ParseGoSum() failed")
|
||||||
}
|
|
||||||
/*
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repo) GoDepsLen() int {
|
func (repo *Repo) GoDepsLen() int {
|
||||||
|
|
3
mtime.go
3
mtime.go
|
@ -162,6 +162,9 @@ func (repo *Repo) updateMtimes() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repo) DidRepoChange() bool {
|
func (repo *Repo) DidRepoChange() bool {
|
||||||
|
if repo.Times == nil {
|
||||||
|
repo.Times = new(GitTimes)
|
||||||
|
}
|
||||||
if repo.didFileChange(".git/HEAD", repo.Times.MtimeHead) {
|
if repo.didFileChange(".git/HEAD", repo.Times.MtimeHead) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue