asdf-vm / asdf-vm/asdf

Improve output of `asdf version` and `asdf info`

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

Description

Based on https://michael.stapelberg.ch/posts/2026-04-05-stamp-it-all-programs-must-report-their-version/

We should improve the output of `version` and `info` commands with code like this:

```go
package version

import (
"runtime/debug"
"strings"
)

func readParts() (revision string, modified, ok bool) {
info, ok := debug.ReadBuildInfo()
if !ok {
return "", false, false
}
settings := make(map[string]string)
for _, s := range info.Settings {
settings[s.Key] = s.Value
}
// When built from a local VCS directory, we can use vcs.revision directly.
if rev, ok := settings["vcs.revision"]; ok {
return rev, settings["vcs.modified"] == "true", true
}
// When built as a Go module (not from a local VCS directory),
// info.Main.Version is something like v0.0.0-20230107144322-7a5757f46310.
v := info.Main.Version // for convenience
if idx := strings.LastIndexByte(v, '-'); idx > -1 {
return v[idx+1:], false, true
}
return "", false, false
}

func Read() string {
revision, modified, ok := readParts()
if !ok {
return ""
}
modifiedSuffix := ""
if modified {
modifiedSuffix = " (modified)"
}

return "https://github.com/gokrazy/tools/commit/" + revision + modifiedSuffix
}
```

Contributor guide

Open the contributing guide

Research direction

Locate the Go implementations and tests for the `asdf version` and `asdf info` commands, then compare their current output with the proposed build-information approach. Use the linked article and example as context; done means both commands report the program revision and modified state in the intended output format.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.