asdf-vm / asdf-vm/asdf

bug: asdf plugin test logic does not match documentation re: version

Open
#2,148 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Go
Stars
25.6k
Forks
941
Avg merge
9h 24m
Merged PRs (30d)
3

Description

### Describe the Bug

The Go code for `pluginTestCommand`:

```go
// grab first version returned by list-all callback if no version provided as
// a CLI argument
if toolVersion == "" {
toolVersion = allVersions[0]
}
```

But the docs say:

> If optional [--asdf-tool-version ] is specified, the tool will be installed with that specific version. Defaults to asdf latest

### Steps to Reproduce

running the following fails:
```bash
asdf plugin test golang https://github.com/asdf-community/asdf-golang.git go version
```

while the following passes:
```bash
asdf plugin test golang --asdf-tool-version $(asdf latest golang) https://github.com/asdf-community/asdf-golang.git go version
```

### Expected Behaviour

running `asdf plugin test` without a setting `asdf-tool-version` should use the latest stable version.

### Actual Behaviour

It uses the first version, which may no longer match the tests.

### Environment

```shell
irrelevant, the code pasted above clearly shows the disparity.
```

### asdf plugins affected (if relevant)

_No response_

Contributor guide

Open the contributing guide

Research direction

Search the Go code for pluginTestCommand and inspect how it selects a version when --asdf-tool-version is absent. Reproduce the issue with the two asdf plugin test commands shown, then compare the selected version with asdf latest. Done means the no-argument command uses the latest stable version while an explicitly supplied version still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.