diff --git a/lib/consts/consts.go b/lib/consts/consts.go index c9a30c71054e..f0164a0ea1f1 100644 --- a/lib/consts/consts.go +++ b/lib/consts/consts.go @@ -17,15 +17,19 @@ var VersionDetails = "" //nolint:gochecknoglobals // the currently running k6 executable. func FullVersion() string { goVersionArch := fmt.Sprintf("%s, %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH) - if VersionDetails != "" { - return fmt.Sprintf("%s (%s, %s)", Version, VersionDetails, goVersionArch) - } - if buildInfo, ok := debug.ReadBuildInfo(); ok { - return fmt.Sprintf("%s (%s, %s)", Version, buildInfo.Main.Version, goVersionArch) + buildInfo, ok := debug.ReadBuildInfo() + if !ok { + return fmt.Sprintf("%s (dev build, %s)", Version, goVersionArch) } - return fmt.Sprintf("%s (dev build, %s)", Version, goVersionArch) + var commit string + for _, s := range buildInfo.Settings { + if s.Key == "vcs.revision" { + commit += "commit/" + s.Value[:10] + } + } + return fmt.Sprintf("%s (%s, %s)", Version, commit, goVersionArch) } // Banner returns the ASCII-art banner with the k6 logo and stylized website URL