Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: rebuilding golden tests fails #45272

Closed
pjweinb opened this issue Mar 28, 2021 · 2 comments
Closed

x/tools/gopls: rebuilding golden tests fails #45272

pjweinb opened this issue Mar 28, 2021 · 2 comments
Labels
gopls Issues related to the Go language server, gopls. Testing An issue that has been verified to require only test changes, not just a test failure. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@pjweinb
Copy link

pjweinb commented Mar 28, 2021

What version of Go are you using (go version)?

go version go1.16.2 darwin/amd64

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/pjw/Library/Caches/go-build"
GOENV="/Users/pjw/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/pjw/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/pjw/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/72/mj6w6gyj5dn6yp_2_tlbdwym00052r/T/go-build679490406=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Following the instructions in golang.org/x/tools/internal/lsp/tests/README.md, I executed

./internal/lsp/reset_golden.sh

What did you expect to see?

i expected no changes

What did you see instead?

	deleted:    internal/lsp/analysis/fillreturns/testdata/src/a/a.go.golden
	deleted:    internal/lsp/analysis/nonewvars/testdata/src/a/a.go.golden
	deleted:    internal/lsp/analysis/noresultvalues/testdata/src/a/a.go.golden
	deleted:    internal/lsp/analysis/simplifycompositelit/testdata/src/a/a.go.golden
	deleted:    internal/lsp/analysis/simplifyrange/testdata/src/a/a.go.golden
	deleted:    internal/lsp/analysis/simplifyslice/testdata/src/a/a.go.golden
	modified:   internal/lsp/testdata/godef/b/h.go.golden
	modified:   internal/lsp/testdata/signature/signature.go.golden
	modified:   internal/lsp/testdata/signature/signature_test.go.golden
	modified:   internal/lsp/testdata/snippets/literal.go.golden

Because of the deleted files the tests no longer pass. (The modified files don't affect test results.)

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Mar 28, 2021
@gopherbot gopherbot added this to the Unreleased milestone Mar 28, 2021
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.6.10 Mar 29, 2021
@stamblerre stamblerre added this to To Do in gopls on-deck Apr 15, 2021
@stamblerre stamblerre added the Testing An issue that has been verified to require only test changes, not just a test failure. label Jun 28, 2021
@ShoshinNikita
Copy link

Analyzer tests don't support rebuilding .golden files. So, the script just deletes .golden files under internal/lsp/analysis/. There are two possible solutions:

  1. Don't remove .golden files for analyzer tests

    #!/bin/bash
    
    - find ./internal/lsp/ -name *.golden -delete
    + find ./internal/lsp/testdata/ -name *.golden -delete
    go test ./internal/lsp/source -golden
    go test ./internal/lsp/ -golden
    go test ./internal/lsp/cmd -golden
  2. Add support for rebuilding .golden files for analyzer tests


There's also a new issue with rebuilding .golden files. Commit golang/tools@4c651fc added summary_generics.txt.golden. It is used when type parameters are enabled:

var summaryFile = "summary.txt"

func init() {
	if typeparams.Enabled {
		summaryFile = "summary_generics.txt"
	}
}

The problem is that we can't rebuild summary.txt.golden and summary_generics.txt.golden at the same time:

typeparams.Enabled summary.txt.golden summary_generics.txt.golden
false rebuilt removed
true removed rebuilt

@stamblerre stamblerre moved this from To Do to P3 in gopls on-deck Jul 15, 2021
@findleyr
Copy link
Contributor

findleyr commented Sep 7, 2023

Closing as redundant with https://go.dev/issue/54845

@findleyr findleyr closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Testing An issue that has been verified to require only test changes, not just a test failure. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
No open projects
Development

No branches or pull requests

5 participants