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: illegal line number panic #37226

Closed
myitcv opened this issue Feb 14, 2020 · 1 comment
Closed

x/tools/gopls: illegal line number panic #37226

myitcv opened this issue Feb 14, 2020 · 1 comment
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@myitcv
Copy link
Member

myitcv commented Feb 14, 2020

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

$ go version
go version devel +b7689f5aa3 Fri Jan 31 06:02:00 2020 +0000 linux/amd64
$ go list -m golang.org/x/tools
golang.org/x/tools v0.0.0-20200213224642-88e652f7a869
$ go list -m golang.org/x/tools/gopls
golang.org/x/tools/gopls v0.1.8-0.20200213224642-88e652f7a869

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/myitcv/.cache/go-build"
GOENV="/home/myitcv/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/myitcv/gos"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/myitcv/.vim/plugged/govim/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build830932815=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Removing the closing } of a function at the end of a file results in a panic:

panic: illegal line number

goroutine 950 [running]:
go/token.(*File).LineStart(0xc000345800, 0x7, 0x0)
	/home/myitcv/gos/src/go/token/position.go:222 +0xe8
golang.org/x/tools/internal/lsp/cache.fixMissingCurlies(0xc000174700, 0xc0001ba4b0, 0xdbfec0, 0xc000397f90, 0xc000345800, 0xc000a8fc80, 0x5f, 0x5f, 0x5, 0xc000174800, ...)
	/home/myitcv/gostuff/pkg/mod/golang.org/x/tools@v0.0.0-20200213224642-88e652f7a869/internal/lsp/cache/parse.go:336 +0x149
golang.org/x/tools/internal/lsp/cache.fixSrc.func1(0xdbf580, 0xc0001ba4b0, 0xdbfec0, 0xc000397f90, 0xba3301)
	/home/myitcv/gostuff/pkg/mod/golang.org/x/tools@v0.0.0-20200213224642-88e652f7a869/internal/lsp/cache/parse.go:302 +0x17d
golang.org/x/tools/internal/lsp/cache.walkASTWithParent.func1(0xdbf580, 0xc0001ba4b0, 0xdc0200)
	/home/myitcv/gostuff/pkg/mod/golang.org/x/tools@v0.0.0-20200213224642-88e652f7a869/internal/lsp/cache/parse.go:288 +0xb2
go/ast.inspector.Visit(0xc00033cf20, 0xdbf580, 0xc0001ba4b0, 0x0, 0x0)
	/home/myitcv/gos/src/go/ast/walk.go:373 +0x3a
go/ast.Walk(0xdbc4c0, 0xc00033cf20, 0xdbf580, 0xc0001ba4b0)
	/home/myitcv/gos/src/go/ast/walk.go:52 +0x66
go/ast.Walk(0xdbc4c0, 0xc00033cf20, 0xdbfec0, 0xc000397f90)
	/home/myitcv/gos/src/go/ast/walk.go:285 +0x2946
go/ast.walkStmtList(0xdbc4c0, 0xc00033cf20, 0xc000c33680, 0x3, 0x4)
	/home/myitcv/gos/src/go/ast/walk.go:32 +0x9e
go/ast.Walk(0xdbc4c0, 0xc00033cf20, 0xdbf580, 0xc0001ba840)
	/home/myitcv/gos/src/go/ast/walk.go:224 +0x1adf
go/ast.Walk(0xdbc4c0, 0xc00033cf20, 0xdbfa80, 0xc0001baa80)
	/home/myitcv/gos/src/go/ast/walk.go:344 +0xd98
go/ast.walkDeclList(0xdbc4c0, 0xc00033cf20, 0xc00069f6f0, 0x1, 0x1)
	/home/myitcv/gos/src/go/ast/walk.go:38 +0x9e
go/ast.Walk(0xdbc4c0, 0xc00033cf20, 0xdbfa00, 0xc000174700)
	/home/myitcv/gos/src/go/ast/walk.go:353 +0x264e
go/ast.Inspect(...)
	/home/myitcv/gos/src/go/ast/walk.go:385
golang.org/x/tools/internal/lsp/cache.walkASTWithParent(0xdbfa00, 0xc000174700, 0xc000c33800)
	/home/myitcv/gostuff/pkg/mod/golang.org/x/tools@v0.0.0-20200213224642-88e652f7a869/internal/lsp/cache/parse.go:271 +0x9e
golang.org/x/tools/internal/lsp/cache.fixSrc(0xc000174700, 0xc000345800, 0xc000a8fc80, 0x5f, 0x5f, 0xc000a8fc80, 0x5f, 0x5f)
	/home/myitcv/gostuff/pkg/mod/golang.org/x/tools@v0.0.0-20200213224642-88e652f7a869/internal/lsp/cache/parse.go:295 +0xc0
golang.org/x/tools/internal/lsp/cache.parseGo(0xdcbea0, 0xc0003c1ef0, 0xc0003bef40, 0xdca560, 0xc0003454a0, 0x2, 0x0)
	/home/myitcv/gostuff/pkg/mod/golang.org/x/tools@v0.0.0-20200213224642-88e652f7a869/internal/lsp/cache/parse.go:140 +0x827
golang.org/x/tools/internal/lsp/cache.(*cache).ParseGoHandle.func1(0xdcbde0, 0xc000c334c0, 0x0, 0x468486)
	/home/myitcv/gostuff/pkg/mod/golang.org/x/tools@v0.0.0-20200213224642-88e652f7a869/internal/lsp/cache/parse.go:57 +0x59
golang.org/x/tools/internal/memoize.(*Handle).run.func1(0xdcbde0, 0xc000c334c0, 0xc0003c1c50, 0xc000345680)
	/home/myitcv/gostuff/pkg/mod/golang.org/x/tools@v0.0.0-20200213224642-88e652f7a869/internal/memoize/memoize.go:216 +0x6b
created by golang.org/x/tools/internal/memoize.(*Handle).run
	/home/myitcv/gostuff/pkg/mod/golang.org/x/tools@v0.0.0-20200213224642-88e652f7a869/internal/memoize/memoize.go:210 +0x116

Log file: fail.log

What did you expect to see?

No panic

What did you see instead?

As above.


cc @stamblerre

FYI @leitzler

@myitcv myitcv added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. gopls Issues related to the Go language server, gopls. labels Feb 14, 2020
@gopherbot gopherbot added this to the Unreleased milestone Feb 14, 2020
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Feb 14, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.4.0 Feb 14, 2020
@gopherbot
Copy link

Change https://golang.org/cl/219498 mentions this issue: internal/lsp/cache: fix crash fixing curlies near EOF

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants