Install downloads and installs a package at the specified version. Returns the path to the installed binary.
(ctx context.Context, pkg *Package, version string)
| 16 | // Install downloads and installs a package at the specified version. |
| 17 | // Returns the path to the installed binary. |
| 18 | func (r *Registry) Install(ctx context.Context, pkg *Package, version string) (string, error) { |
| 19 | // Apply the aqua version_override matching this version before deciding |
| 20 | // how to install (asset, format, checksum, and even type can differ |
| 21 | // between versions). |
| 22 | pkg = resolveVersionOverride(pkg, version) |
| 23 | |
| 24 | if pkg.IsGoPackage() { |
| 25 | return installGoPackage(ctx, pkg, version) |
| 26 | } |
| 27 | return r.installGitHubRelease(ctx, pkg, version) |
| 28 | } |
| 29 | |
| 30 | // installGoPackage installs a Go package using "go install". |
| 31 | func installGoPackage(ctx context.Context, pkg *Package, version string) (string, error) { |