1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:54:43 -07:00

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>
This commit is contained in:
Rebecca Stambler 2019-06-07 15:55:45 -04:00
parent 25a4f13759
commit a99d5a724b
3 changed files with 6 additions and 3 deletions

View File

@ -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)
}

View File

@ -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)
}
}

View File

@ -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 {