()
| 86 | } |
| 87 | |
| 88 | func (e *Extension) CurrentVersion() string { |
| 89 | e.mu.RLock() |
| 90 | if e.currentVersion != "" { |
| 91 | defer e.mu.RUnlock() |
| 92 | return e.currentVersion |
| 93 | } |
| 94 | e.mu.RUnlock() |
| 95 | |
| 96 | var currentVersion string |
| 97 | switch e.kind { |
| 98 | case LocalKind: |
| 99 | case BinaryKind: |
| 100 | if manifest, err := e.loadManifest(); err == nil { |
| 101 | currentVersion = manifest.Tag |
| 102 | } |
| 103 | case GitKind: |
| 104 | if sha, err := e.gitClient.CommandOutput([]string{"rev-parse", "HEAD"}); err == nil { |
| 105 | currentVersion = string(bytes.TrimSpace(sha)) |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | e.mu.Lock() |
| 110 | e.currentVersion = currentVersion |
| 111 | e.mu.Unlock() |
| 112 | |
| 113 | return e.currentVersion |
| 114 | } |
| 115 | |
| 116 | func (e *Extension) LatestVersion() string { |
| 117 | e.mu.RLock() |
no test coverage detected