Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/cli/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ func TestRunVersionSkipsAPIKeyRequirement(t *testing.T) {
}

output := strings.TrimSpace(stdout.String())
want := "transblog version=v1.2.3 commit=abc1234 build_time=2026-02-24T20:30:00Z"
want := versionpkg.String()
if output != want {
t.Fatalf("stdout = %q, want %q", output, want)
}
Expand Down
15 changes: 13 additions & 2 deletions internal/version/version.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package version

import "fmt"
import (
"fmt"
"runtime"
)

var (
Version = "dev"
Expand All @@ -9,5 +12,13 @@ var (
)

func String() string {
return fmt.Sprintf("transblog version=%s commit=%s build_time=%s", Version, Commit, BuildTime)
return fmt.Sprintf(
"transblog version=%s commit=%s build_time=%s go=%s os=%s arch=%s",
Version,
Commit,
BuildTime,
runtime.Version(),
runtime.GOOS,
runtime.GOARCH,
)
}
33 changes: 33 additions & 0 deletions internal/version/version_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package version

import (
"fmt"
"runtime"
"testing"
)

func TestStringIncludesGoRuntimeAndPlatform(t *testing.T) {
oldVersion := Version
oldCommit := Commit
oldBuildTime := BuildTime

Version = "v1.2.3"
Commit = "abc1234"
BuildTime = "2026-02-24T20:30:00Z"
t.Cleanup(func() {
Version = oldVersion
Commit = oldCommit
BuildTime = oldBuildTime
})

got := String()
want := fmt.Sprintf(
"transblog version=v1.2.3 commit=abc1234 build_time=2026-02-24T20:30:00Z go=%s os=%s arch=%s",
runtime.Version(),
runtime.GOOS,
runtime.GOARCH,
)
if got != want {
t.Fatalf("String() = %q, want %q", got, want)
}
}
Loading