Beispiel #1
0
func repoRoot(p *goutil.Package) (*Root, error) {
	rdir := filepath.Join(p.Build.Root, "src")
	cmd, path, err := vcs.FromDir(p.Build.Dir, rdir)
	if err != nil {
		return nil, err
	}
	dir := filepath.Join(rdir, path)
	return &Root{root: dir, path: path, cmd: cmd}, nil
}
Beispiel #2
0
func VCSFromDir(dir, srcRoot string) (*VCS, string, error) {
	vcscmd, reporoot, err := vcs.FromDir(dir, srcRoot)
	if err != nil {
		return nil, "", err
	}
	vcsext := cmd[vcscmd]
	if vcsext == nil {
		return nil, "", fmt.Errorf("%s is unsupported: %s", vcscmd.Name, dir)
	}
	return vcsext, reporoot, nil
}