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 <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
diff --git a/internal/lsp/debug/info.1.11.go b/internal/lsp/debug/info.1.11.go
index b29a157..68932d7 100644
--- a/internal/lsp/debug/info.1.11.go
+++ b/internal/lsp/debug/info.1.11.go
@@ -12,5 +12,5 @@
)
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 70856f6..f857f1b 100644
--- a/internal/lsp/debug/info.1.12.go
+++ b/internal/lsp/debug/info.1.12.go
@@ -14,7 +14,7 @@
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 @@
}
}
} 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 4173a91..8f2bf7d 100644
--- a/internal/lsp/debug/info.go
+++ b/internal/lsp/debug/info.go
@@ -19,6 +19,9 @@
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 {