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
cmd/govim: goimports fails in github.com/eliasnaur/gophercon-uk-2019-talk #466
Comments
Thanks for the report. Bizarrely, I cannot reproduce this any more. I used the following as a starting point:
then waited for "things to settle", which is more precisely defined as waiting for the following to appear in the
Then delete line 6 (via package main
import (
"gophercon/simple"
"log"
"gioui.org/ui"
"gioui.org/ui/app"
"gioui.org/ui/layout"
)
func main() {
go func() {
theme := simple.NewTheme()
w := app.NewWindow()
ops := new(ui.Ops)
btn := new(simple.IconButton)
q := w.Queue()
for e := range w.Events() {
switch e := e.(type) {
case app.UpdateEvent:
cfg := &e.Config
ops.Reset()
theme.Reset(cfg)
cs := layout.RigidConstraints(e.Size)
for e, ok := btn.Next(q); ok; e, ok = btn.Next(q) {
log.Println(e)
}
btn.Layout(cfg, ops, cs)
w.Update(ops)
}
}
}()
app.Main()
} Are you able to repro with the above? |
I can't reproduce the bug with your steps. I re-reproduced the bug on my local checkout of gophercon-uk-2019 a few times, but suddenly I couldn't. Event the steps from my original report doesn't reproduce the bug anymore :( I suppose we can close this as not reproducible. I'll re-open it if I manage to reproduce the error again. Perhaps my home machine still has the problem. |
Please do. |
Aaaand it's back! I'm not sure what makes it intermittent, but now I can reproduce the bug with my own steps and for a small demo with just a single directory with a go.mod and a single main.go. But I can't reproduce the bug with @myitcv's steps above. |
Got somehow nerd-sniped into this as well on my way home from work. Haven't had time to dive deeper, but I realised that the connection was pretty bad on my way home, and during this "things to settle" wait, there were a few network requests to gioui.org. Could it be related to I had to try running it at home again but manually blocking the network requests for a few seconds, then I'm able to reproduce it again. |
One thing to potentially note here. With current master (b6bbbae) we do not have a number of fixes to race conditions, threading model etc in
This could be a very significant part of the problem. Again, with https://github.com/myitcv/govim/tree/tools_gopls_95c3470cfb70 the problem may just have "gone away". Otherwise, it's possible (likely?) that the initial run of The one other thing to note from previous tests is that the git server behind |
For some reason, setting GOPATH=$HOME makes goimports work. Unsetting
GOPATH again makes the problem re-appear. That applies to @myitcv's example
as well.
|
That's interesting. I'm still stuck as to how you reproduce this with my steps given I can't reproduce it. But it sounds like @leitzler has made progress on reproducing? |
Unfortunately I'm back to not being able to reproduce it (in a consistent way). Played around with different network issues but after letting network requests through it does actually recover. Next save formats everything.. @eliasnaur just out of curiosity, could you add a pair of logs where you do the same steps where one works and the other doesn't? |
I think I can do better. Here is a Dockerfile with everything set up: https://gist.github.com/eliasnaur/a61fb0ad106b3a762c2e81ec8d82a464 I can then reproduce the problem with:
and then following the instructions from my report. I did Then, running |
Ha! Nice repo indeed 👍. I just gave it a quick try but it didn't work at all, as in doesn't seem to try to load govim. edit: Ops, ran vi instead of vim, have it aliased on my machine. |
Able to repro at least. But did you not have I've seen some places where scripts/code assume that I'm not super familiar with gopls internals, but maybe here for example? https://github.com/golang/tools/blob/922a4ee32d1add0a49cd363b04bb56407baa2ec6/internal/lsp/cache/view.go#L193 |
I've run with GOPATH cleared ever since I set GO111MODULE=on on my machines. |
@leitzler created a fix for this in https://go-review.googlesource.com/c/tools/+/191600/ We're just blocked on golang/go#33647, then we can update |
Because https://go-review.googlesource.com/c/tools/+/192719 is listed in 6961210, I assume this is fixed with v0.0.23. Thank you for working on this! |
What version of Vim/Gvim are you using?
Vim/Gvim version
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
OutputWhat version/commit of
govim
are you using?Git commit b6bbbae.
What is the output of
:messages
in Vim?Messages maintainer: Bram Moolenaar <Bram@vim.org>
Do the Vim channel,
govim
orgopls
log files show anything interesting?@myitcv kindly debugged the issue with me and found nothing interesting in the logs.
What did you do?
I then deleted the
import "gioui.org/ui/layout"
line and issued:w
to save the file.What did you expect to see?
The import line re-added by govim.
What did you see instead?
No change.
The text was updated successfully, but these errors were encountered: