gopls: fix the reset_golden.sh script and regenerate golden files

Update the reset_golden.sh script to run the ./test and ./internal/lsp
directories, following the deprecation of ./internal/lsp/cmd and
./internal/lsp/source tests. Also, fix it to generate golden data for
tests that only run at 1.17 and earlier.

Use the newly fixed script to sync the golden data.

For golang/go#54845

Change-Id: I2b42dac91cf1c7e2e8e25fd2aa8ab23c91e05c6c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/434635
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Robert Findley 2022-09-26 12:16:58 -04:00
parent 49a686d2a2
commit c5cd943077
4 changed files with 57 additions and 49 deletions

View File

@ -4,11 +4,27 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#
# Regenerates the *.golden files in the ./internal/lsp/testdata directory.
# Updates the *.golden files ... to match the tests' current behavior.
set -eu
GO117BIN="go1.17.9"
command -v $GO117BIN >/dev/null 2>&1 || {
go install golang.org/dl/$GO117BIN@latest
$GO117BIN download
}
find ./internal/lsp/testdata -name *.golden ! -name summary*.txt.golden -delete
go test ./internal/lsp/source -golden
go test ./internal/lsp/ -golden
go test ./internal/lsp/cmd -golden
# Here we intentionally do not run the ./internal/lsp/source tests with
# -golden. Eventually these tests will be deleted, and in the meantime they are
# redundant with the ./internal/lsp tests.
#
# Note: go1.17.9 tests must be run *before* go tests, as by convention the
# golden output should match the output of gopls built with the most recent
# version of Go. If output differs at 1.17, tests must be tolerant of the 1.17
# output.
$GO117BIN test ./internal/lsp -golden
go test ./internal/lsp -golden
$GO117BIN test ./test -golden
go test ./test -golden

View File

@ -1,3 +1,28 @@
-- H-hoverdef --
```go
type H interface {
Goodbye() //@mark(AGoodbye, "Goodbye")
}
```
[`a.H` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#H)
-- I-hoverdef --
```go
type I interface {
B() //@mark(AB, "B")
J
}
```
[`a.I` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#I)
-- J-hoverdef --
```go
type J interface {
Hello() //@mark(AHello, "Hello")
}
```
[`a.J` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#J)
-- Lock-hoverdef --
```go
func (*sync.Mutex).Lock()
@ -165,31 +190,6 @@ const h untyped int = 2
Constant block.
-- H-hoverdef --
```go
type H interface {
Goodbye() //@mark(AGoodbye, "Goodbye")
}
```
[`a.H` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#H)
-- I-hoverdef --
```go
type I interface {
B() //@mark(AB, "B")
J
}
```
[`a.I` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#I)
-- J-hoverdef --
```go
type J interface {
Hello() //@mark(AHello, "Hello")
}
```
[`a.J` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#J)
-- make-hoverdef --
```go
func make(t Type, size ...int) Type

View File

@ -64,6 +64,18 @@ func (Thing).Method(i int) string
```
[`(a.Thing).Method` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing.Method)
-- NextThing-hoverdef --
```go
type NextThing struct {
Thing
Value int
}
func (*NextThing).Method3() int
func (NextThing).another() string
```
[`a.NextThing` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#NextThing)
-- Other-definition --
godef/a/d.go:9:5-10: defined here as ```go
var Other Thing
@ -177,15 +189,3 @@ func Things(val []string) []Thing
-- a-hoverdef --
Package a is a package for testing go to definition.
-- NextThing-hoverdef --
```go
type NextThing struct {
Thing
Value int
}
func (*NextThing).Method3() int
func (NextThing).another() string
```
[`a.NextThing` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#NextThing)

View File

@ -1,11 +1,3 @@
-- Pparam-hoverdef --
```go
type parameter P interface{~int|string}
```
-- Pvar-hoverdef --
```go
type parameter P interface{~int|string}
```
-- ValueQfield-hoverdef --
```go
field Q int