need better handling here

This commit is contained in:
Jeff Carr 2025-01-20 01:40:47 -06:00
parent 3b17710c1a
commit 336ab60e01
1 changed files with 6 additions and 5 deletions

View File

@ -9,6 +9,8 @@ import (
"go.wit.com/log" "go.wit.com/log"
) )
// TODO: this needs to be redone in a smarter way
// to identify which repos have things to build in them
func (repo *Repo) GetRepoType() string { func (repo *Repo) GetRepoType() string {
if repo == nil { if repo == nil {
return "nil" return "nil"
@ -24,9 +26,6 @@ func (repo *Repo) GetRepoType() string {
if repo.GoInfo.GoPlugin { if repo.GoInfo.GoPlugin {
return "plugin" return "plugin"
} }
if repo.GoInfo.GoProtobuf {
return "protobuf"
}
if repo.GoInfo.GoBinary { if repo.GoInfo.GoBinary {
if repo.Exists(".plugin") { if repo.Exists(".plugin") {
log.Warn("gitpb.RepoType() plugin was not set correctly") log.Warn("gitpb.RepoType() plugin was not set correctly")
@ -35,6 +34,10 @@ func (repo *Repo) GetRepoType() string {
} }
return "binary" return "binary"
} }
// binary should always take precidence over libraries that are protobuf's
if repo.GoInfo.GoProtobuf {
return "protobuf"
}
if repo.GoInfo.GoLibrary { if repo.GoInfo.GoLibrary {
return "library" return "library"
} }
@ -48,11 +51,9 @@ func (repo *Repo) setRepoType() {
} }
if repo.Exists(".plugin") { if repo.Exists(".plugin") {
repo.GoInfo.GoPlugin = true repo.GoInfo.GoPlugin = true
return
} }
if ok, _, _ := repo.IsProtobuf(); ok { if ok, _, _ := repo.IsProtobuf(); ok {
repo.GoInfo.GoProtobuf = true repo.GoInfo.GoProtobuf = true
return
} }
switch repo.goListRepoType() { switch repo.goListRepoType() {
case "binary": case "binary":