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: creating a new file in a package causes import errors to show and disappear as the new file is edited #36960

Open
zikaeroh opened this issue Feb 1, 2020 · 3 comments

Comments

@zikaeroh
Copy link

@zikaeroh zikaeroh commented Feb 1, 2020

Please answer these questions before submitting your issue. Thanks!

What did you do?

In my project (https://github.com/hortbot/hortbot), added a new file in the bot package, and typed package bot, then started to work in it.

What did you expect to see?

No errors when I'm in a good state.

What did you see instead?

Every time I edit the file, I can see the other files in the package flash red and back again. There are diagnostics being sent and then removed repeatedly on edit. Sometimes, I can edit the file, and they'll persist. Looking at the logs, it appears to be errors about imports.

Logs: https://gist.github.com/zikaeroh/7a9674c79a34a35e3e8973ceffae5c3c

Build info

golang.org/x/tools/gopls master
    golang.org/x/tools/gopls@v0.1.8-0.20200131211209-ecb101ed6550 h1:0NRGhttWS2Y5cK/h+uPZyIQewGG9mx0M3DRRkuMAjNU=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/mod@v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20200131211209-ecb101ed6550 h1:3Kc3/T5DQ/majKzDmb+0NzmbXFhKLaeDTp3KqVPV5Eo=
    golang.org/x/xerrors@v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
    honnef.co/go/tools@v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
    mvdan.cc/xurls/v2@v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=

Go info

go version go1.13.7 linux/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jake/.cache/go-build"
GOENV="/home/jake/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jake/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/jake/zikaeroh/hortbot/hortbot/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-build291942412=/tmp/go-build -gno-record-gcc-switches"
@gopherbot gopherbot added this to the Unreleased milestone Feb 1, 2020
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Feb 1, 2020

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.4.0 Feb 2, 2020
@golang golang deleted a comment from gopherbot Feb 13, 2020
gopherbot pushed a commit to golang/tools that referenced this issue Feb 13, 2020
This change fixes an issue where import errors would not disappear when creating new files in a module by removing the segment of code where we check for listErrors when fixing imports.

Updates golang/go#36960

Change-Id: Iefa17edeb0417cac7e33ffa88faf7c9a607e98b3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/219222
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@ridersofrohan

This comment has been minimized.

Copy link

@ridersofrohan ridersofrohan commented Feb 13, 2020

@zikaeroh I just pushed up https://go-review.googlesource.com/c/tools/+/219222 that should have fixed this issue. Can you give it a try when you get the chance?

@zikaeroh

This comment has been minimized.

Copy link
Author

@zikaeroh zikaeroh commented Feb 13, 2020

No, the issue still appears. Note that this extends out into all packages that depend on the package with a new file.

New logs: https://gist.github.com/zikaeroh/69ff621bcaff40c8199e7c0d651cf4be

I add a new file a.go, it appears to be fine, then reverse dependencies show red. Then, I hit "enter" and insert a new line, and then the bot package breaks too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.