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:
parent
25a4f13759
commit
a99d5a724b
|
@ -12,5 +12,5 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func printBuildInfo(w io.Writer, verbose bool, mode PrintMode) {
|
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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
func printBuildInfo(w io.Writer, verbose bool, mode PrintMode) {
|
func printBuildInfo(w io.Writer, verbose bool, mode PrintMode) {
|
||||||
if info, ok := debug.ReadBuildInfo(); ok {
|
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)
|
printModuleInfo(w, &info.Main, mode)
|
||||||
if verbose {
|
if verbose {
|
||||||
for _, dep := range info.Deps {
|
for _, dep := range info.Deps {
|
||||||
|
@ -22,7 +22,7 @@ func printBuildInfo(w io.Writer, verbose bool, mode PrintMode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(w, "no module information, gopls not built in module mode\n")
|
fmt.Fprintf(w, "version %s, built in $GOPATH mode", Version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,9 @@ const (
|
||||||
HTML
|
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.
|
// This writes the version and environment information to a writer.
|
||||||
func PrintVersionInfo(w io.Writer, verbose bool, mode PrintMode) {
|
func PrintVersionInfo(w io.Writer, verbose bool, mode PrintMode) {
|
||||||
if !verbose {
|
if !verbose {
|
||||||
|
|
Loading…
Reference in New Issue