package repolist // does processing on the go.mod and go.sum files import ( "errors" "strings" "go.wit.com/log" ) // scans through everything in the go.sum file to make // sure the versions are correct when attempting to do a GUI release func (rl *RepoList) CheckValidGoSum(r *RepoRow) (bool, error) { log.Log(REPOWARN, "CheckValidGoSum() started") ok, err := r.pb.RedoGoMod() if !ok { log.Log(REPOWARN, "CheckValidGoSum() MakeRedomod() failed", err) return ok, err } // go through each go.sum dependancy to see if the package is released for depPath, version := range r.Status.GoConfig() { log.Log(REPO, " ", depPath, version) // lookup the repo deprs := rl.FindRepo(depPath) if deprs == nil { // well, the go.sum dependancy hasn't been processed or doesn't exist // so, download it? ignore it? // for now, if it's not one of the GUI repos, assume it's readonly and ignore it if strings.HasPrefix(depPath, "go.wit.com") { log.Log(REPOWARN, "Run: go get -v", depPath) return false, errors.New("CheckValidGoSum() download repo: " + depPath) } // it's probably okay. running a compile check before this would be a good test continue } if deprs.ReadOnly() { // ignore versioning on other repos. todo: help fix this situation somehow? continue } if deprs.CheckDirty() { return false, errors.New("CheckValidGoSum() depends on dirty repo " + deprs.GoPath()) } currentV := deprs.Status.GetCurrentVersion() targetV := deprs.Status.GetTargetVersion() if currentV != targetV { return false, errors.New("CheckValidGoSum() depends on yet unreleased repo " + deprs.GoPath()) } } // no dependancies error'd out. It should be ok to release this package log.Log(REPOWARN, "Releasing this should be ok", r.GoPath()) return true, nil }