From 8a49c8fa275d4ae6437777cbefaff9d5d9e4acaf Mon Sep 17 00:00:00 2001 From: Qi Xiao Date: Tue, 3 Jul 2018 00:36:40 +0100 Subject: [PATCH] program: Add Go version to output of -buildinfo. --- program/subprograms.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/program/subprograms.go b/program/subprograms.go index 4bd91f07..42e7874f 100644 --- a/program/subprograms.go +++ b/program/subprograms.go @@ -3,6 +3,7 @@ package program import ( "fmt" "os" + "runtime" "github.com/elves/elvish/buildinfo" daemonsvc "github.com/elves/elvish/daemon" @@ -44,11 +45,14 @@ type ShowBuildInfo struct { func (info ShowBuildInfo) Main([]string) int { if info.JSON { - fmt.Printf(`{"version": %s, "goroot": %s, "gopath": %s}`+"\n", - quoteJSON(buildinfo.Version), quoteJSON(buildinfo.GoRoot), - quoteJSON(buildinfo.GoPath)) + fmt.Printf(`{"version": %s,`, quoteJSON(buildinfo.Version)) + fmt.Printf(` "goversion": %s,`, quoteJSON(runtime.Version())) + fmt.Printf(` "goroot": %s,`, quoteJSON(buildinfo.GoRoot)) + fmt.Printf(` "gopath": %s}`, quoteJSON(buildinfo.GoPath)) + fmt.Println() } else { fmt.Println("Version:", buildinfo.Version) + fmt.Println("Go version:", runtime.Version()) fmt.Println("GOROOT at build time:", buildinfo.GoRoot) fmt.Println("GOPATH at build time:", buildinfo.GoPath) }