summaryrefslogtreecommitdiff
path: root/repoNew.go
diff options
context:
space:
mode:
Diffstat (limited to 'repoNew.go')
-rw-r--r--repoNew.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/repoNew.go b/repoNew.go
index b87ee4c..772e9b2 100644
--- a/repoNew.go
+++ b/repoNew.go
@@ -1,9 +1,12 @@
package forgepb
import (
+ "fmt"
"os/user"
+ "strings"
"go.wit.com/lib/protobuf/gitpb"
+ "go.wit.com/log"
)
func (f *Forge) NewGoPathRepo(gopath string) (*gitpb.Repo, error) {
@@ -16,6 +19,24 @@ func (f *Forge) NewGoPathRepo(gopath string) (*gitpb.Repo, error) {
return repo, nil
}
+// golang versions MUST be vX.X.X
+// it can not be vX.X and it also can not be v0.0.0
+// verifies the version is format v3.2.1
+func (f *Forge) ValidGoVersion(ver string) (bool, error) {
+ if ver == "v0.0.0" {
+ return false, fmt.Errorf("golang does not allow version v0.0.0")
+ }
+ if !strings.HasPrefix(ver, "v") {
+ return false, fmt.Errorf("(%s) invalid. golang versions must start with a 'v'", ver)
+ }
+ xver := ver[1:]
+ parts := strings.Split(xver, ".")
+ if len(parts) != 3 {
+ return false, fmt.Errorf("(%s) invalid. golang versions must have exactly 3 numbers (v1.2.3)", ver)
+ }
+ return true, nil
+}
+
func (f *Forge) VerifyBranchNames(newr *gitpb.Repo) {
// log.Info("init worked for", newr.GoPath)
@@ -98,3 +119,12 @@ func (f *Forge) configDevelBranchName(repo *gitpb.Repo) string {
}
return "devel"
}
+
+func (f *Forge) AddFullPath(fulldir string) *gitpb.Repo {
+ repo := f.Repos.FindByFullPath(fulldir)
+ if repo != nil {
+ return repo
+ }
+ log.Info("don't know how to add full paths yet", fulldir)
+ return nil
+}