From a99d5a724b61ab88cc2f8b0b0bf623d2069e137d Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Fri, 7 Jun 2019 15:55:45 -0400 Subject: [PATCH] internal/lsp: add a Version constant This change will allow users in $GOPATH mode to have some semblance of a gopls version. Change-Id: I1b490d18fdf7550c54d56653ae500dc4dc25ee3b Reviewed-on: https://go-review.googlesource.com/c/tools/+/181238 Run-TryBot: Rebecca Stambler Reviewed-by: Ian Cottrell --- internal/lsp/debug/info.1.11.go | 2 +- internal/lsp/debug/info.1.12.go | 4 ++-- internal/lsp/debug/info.go | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/lsp/debug/info.1.11.go b/internal/lsp/debug/info.1.11.go index b29a1570..68932d7b 100644 --- a/internal/lsp/debug/info.1.11.go +++ b/internal/lsp/debug/info.1.11.go @@ -12,5 +12,5 @@ import ( ) func printBuildInfo(w io.Writer, verbose bool, mode PrintMode) { - fmt.Fprintf(w, "no module information, gopls not built with go 1.11 or earlier\n") + fmt.Fprintf(w, "version %s, built in $GOPATH mode", Version) } diff --git a/internal/lsp/debug/info.1.12.go b/internal/lsp/debug/info.1.12.go index 70856f6c..f857f1be 100644 --- a/internal/lsp/debug/info.1.12.go +++ b/internal/lsp/debug/info.1.12.go @@ -14,7 +14,7 @@ import ( func printBuildInfo(w io.Writer, verbose bool, mode PrintMode) { if info, ok := debug.ReadBuildInfo(); ok { - fmt.Fprintf(w, "%v\n", info.Path) + fmt.Fprintf(w, "%v %v\n", info.Path, Version) printModuleInfo(w, &info.Main, mode) if verbose { for _, dep := range info.Deps { @@ -22,7 +22,7 @@ func printBuildInfo(w io.Writer, verbose bool, mode PrintMode) { } } } else { - fmt.Fprintf(w, "no module information, gopls not built in module mode\n") + fmt.Fprintf(w, "version %s, built in $GOPATH mode", Version) } } diff --git a/internal/lsp/debug/info.go b/internal/lsp/debug/info.go index 4173a91c..8f2bf7d2 100644 --- a/internal/lsp/debug/info.go +++ b/internal/lsp/debug/info.go @@ -19,6 +19,9 @@ const ( HTML ) +// Version is a manually-updated mechanism for tracking versions. +const Version = "v0.0.1-20190607+alpha" + // This writes the version and environment information to a writer. func PrintVersionInfo(w io.Writer, verbose bool, mode PrintMode) { if !verbose {