repo/repo.go
func GenerateRule(repo Repo) *rule.Rule {
	r := rule.NewRule("go_repository", repo.Name)
	if repo.Commit != "" {
		r.SetAttr("commit", repo.Commit)
	}
	if repo.Tag != "" {
		r.SetAttr("tag", repo.Tag)
	}
	r.SetAttr("importpath", repo.GoPrefix)
	if repo.Remote != "" {
		r.SetAttr("remote", repo.Remote)
	}
	if repo.VCS != "" {
		r.SetAttr("vcs", repo.VCS)
	}
	if repo.Version != "" {
		r.SetAttr("version", repo.Version)
	}
	if repo.Sum != "" {
		r.SetAttr("sum", repo.Sum)
	}
	if repo.Replace != "" {
		r.SetAttr("replace", repo.Replace)
	}
	return r
}
func GenerateRule(repo Repo) *rule.Rule {
	r := rule.NewRule("go_repository", repo.Name)
	if repo.Commit != "" {
		r.SetAttr("commit", repo.Commit)
	}
	if repo.Tag != "" {
		r.SetAttr("tag", repo.Tag)
	}
	r.SetAttr("importpath", repo.GoPrefix)
	if repo.Remote != "" {
		r.SetAttr("remote", repo.Remote)
	}
	if repo.VCS != "" {
		r.SetAttr("vcs", repo.VCS)
	}
	if repo.Version != "" {
		r.SetAttr("version", repo.Version)
	}
	if repo.Sum != "" {
		r.SetAttr("sum", repo.Sum)
	}
	if repo.Replace != "" {
		r.SetAttr("replace", repo.Replace)
	}
	return r
}
// GenerateRule returns a repository rule for the given repository that can
// be written in a WORKSPACE file.