diff options
| author | Jeff Carr <[email protected]> | 2024-12-17 06:37:14 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-17 06:37:14 -0600 |
| commit | 233f7bca767aab9df55adea409e9820050631586 (patch) | |
| tree | 1ce61760e8b31077b9accc9b1da978d935a132d3 /reloadRepoType.go | |
| parent | 4bc95ad2684cb42159229b8198aa8a2377f80aa1 (diff) | |
lots of changes to isolate exec 'git'
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 { |
