hashicorp / hashicorp/hc-install

Expose latest matched version

Open
#201 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
62
Forks
27
Avg merge
2d 5h
Merged PRs (30d)
4

Description

## Background

When installing a latest version e.g. via

- [`releases.LatestVersion`](https://pkg.go.dev/github.com/hashicorp/hc-install@v0.6.4/releases#LatestVersion)
- [`checkpoint.LatestVersion`](https://pkg.go.dev/github.com/hashicorp/hc-install@v0.6.4/checkpoint#LatestVersion)

or even when discovering existing installation e.g. via [`fs.Version`](https://pkg.go.dev/github.com/hashicorp/hc-install@v0.6.4/fs#Version)

it is currently impossible for the consumer to tell what version was installed after calling `Install`, `Ensure` or `Find` without executing the binary while the library internally already has the knowledge of the matched version.

## Proposal

Expose matched version for the consumer

## Considerations

This may require some breaking changes, e.g. returning a struct `{ ExecPath string, Version *version.Version }` instead of just `string` (exec path) from the various methods like `Install`, `Ensure` and `Find` per https://pkg.go.dev/github.com/hashicorp/hc-install@v0.6.4/src

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Install, Ensure, and Find entry points and the releases.LatestVersion, checkpoint.LatestVersion, and fs.Version paths referenced in the issue. Determine how the matched version can be returned alongside the executable path, then verify that consumers can read it without executing the binary and that the affected API behavior is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.