summaryrefslogtreecommitdiff
path: root/finalGoDepsCheckOk.go
blob: f492a320e1774b126ab9ccfff3d9a0c053901caa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"errors"
	"fmt"
	"path/filepath"

	"go.wit.com/lib/env"
	"go.wit.com/lib/protobuf/gitpb"
)

func finalGoDepsCheckOk(check *gitpb.Repo) error {
	err := me.forge.FinalGoDepsCheckOk(check)
	if err == nil {
		// log.Info("FINDNEXT: forge.FinalGoDepsCheck(check) worked!")
		return nil
	}
	// log.Printf("FINDNEXT: forge.FinalGoDepsCheck(check) err (%v)\n", err)
	return err
}

func testGoDepsCheckOk(godeps *gitpb.GoDeps) error {
	if godeps == nil {
		return errors.New("testGoDepsCheckOk() godeps == nil")
	}
	all := godeps.SortByGoPath()
	for all.Scan() {
		depRepo := all.Next()
		fullpath := filepath.Join(env.Get("gopath"), depRepo.GoPath)
		found := me.forge.Repos.FindByFullPath(fullpath)
		if found == nil {
			continue
		}
		return fmt.Errorf("testGoDepsCheckOk() dep is being upgraded %s", depRepo.GoPath)
	}
	return nil
}