Conficts between memory and disk when there has been no external editing
Answered
I have been getting this error message a lot, and I get sent to this documentation page. I am not editing anything in an external editor.
Also, the cursor sometimes jumps around inexplicably, particularly as I do auto-suggest (command-Space). (Note that I use IdeaVIM)
My guess is that File Watchers are involved (gocmt, gofmt, goimport, golint). These are triggered on save (which happens automatically) and some potentially edit a fie immediately, so that the save can conflict with the File Watcher's action. But I have no good evidence for that guess.
How can I avoid this?
What can I do about this?
Please sign in to leave a comment.
Hi,
I think it is indeed caused by file watchers. I'd suggest disabling gofmt and goimports and switching to the builtin IDE formatter.
OK, I will try that.
@dmitry nemerov
I do need to run external tools because the CI system runs them, and I want to catch problems as soon as possible, but I have reduced my File Watchers and the problem is reduced. I am not sure which one caused the problem.
If you use a version control system, you can run `go fmt` on commit and use the builtin formatted for the rest of the time.
File watchers which don't modify files should not cause problems, so it's likely was gofmt or goimports.