Skip to content

Commit

Permalink
internal/lsp: add a Version constant
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stamblerre committed Jun 11, 2019
1 parent 25a4f13 commit a99d5a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/lsp/debug/info.1.11.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
4 changes: 2 additions & 2 deletions internal/lsp/debug/info.1.12.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ 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 {
printModuleInfo(w, dep, mode)
}
}
} else {
fmt.Fprintf(w, "no module information, gopls not built in module mode\n")
fmt.Fprintf(w, "version %s, built in $GOPATH mode", Version)
}
}

Expand Down
3 changes: 3 additions & 0 deletions internal/lsp/debug/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a99d5a7

Please sign in to comment.