diff options
Diffstat (limited to 'reloadRepoType.go')
| -rw-r--r-- | reloadRepoType.go | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/reloadRepoType.go b/reloadRepoType.go index 52846d2..e1c1735 100644 --- a/reloadRepoType.go +++ b/reloadRepoType.go @@ -9,26 +9,58 @@ import ( "go.wit.com/log" ) -func (repo *Repo) RepoType() string { +func (repo *Repo) GetRepoType() string { if repo == nil { return "nil" } - if repo.GetGoPlugin() { + if repo.GoInfo == nil { + log.Warn("gitpb.RepoType() plugin was not set correctly") + log.Warn("gitpb.RepoType() plugin was not set correctly") + log.Warn("gitpb.RepoType() plugin was not set correctly") + repo.GoInfo = new(GoInfo) + repo.setRepoType() + } + + if repo.GoInfo.GoPlugin { return "plugin" } - if repo.GetGoBinary() { + if repo.GoInfo.GoProtobuf { + return "protobuf" + } + if repo.GoInfo.GoBinary { if repo.Exists(".plugin") { + log.Warn("gitpb.RepoType() plugin was not set correctly") + repo.GoInfo.GoPlugin = true return "plugin" } return "binary" } + if repo.GoInfo.GoLibrary { + return "library" + } + return "err" +} + +func (repo *Repo) setRepoType() { + if repo == nil { + return + } + if repo.Exists(".plugin") { + repo.GoInfo.GoPlugin = true + return + } if ok, _, _ := repo.IsProtobuf(); ok { - return "protobuf" + repo.GoInfo.GoProtobuf = true + return } - if repo.GetGoLibrary() { - return "library" + switch repo.goListRepoType() { + case "binary": + repo.GoInfo.GoBinary = true + return + case "library": + repo.GoInfo.GoLibrary = true + return } - return "" } func (repo *Repo) goListRepoType() string { |
