-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: use temporary fork of x/tools and gopls (#689)
In d80f0e2 we upgraded to the latest x/tools and gopls. But as is documented in golang.org/issue/36601 there is a bug whereby reverting a file to an earlier state results in no diagnostics where they are in fact expected. Fix this by using a temporary fork of x/tools and gopls where CL 214586 is partially reverted. Also add tests to ensure the various permutations of transitions to/from error state and back work as expected.
- Loading branch information
Showing
11 changed files
with
212 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
48 changes: 48 additions & 0 deletions
48
cmd/govim/testdata/scenario_bugs/bug_gopls_36601_error_error_error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# A test that ensures we have a fix for golang.org/issue/36601. Specifically | ||
# that transitions between various states leave diagnostics in the expect state | ||
# when we revert back to the original file contents. | ||
# | ||
# This test moves from error -> error -> error, i.e. we are making a change | ||
# that should not alter the diagnostics, then undoing that change. | ||
|
||
[short] skip 'Skip short because we sleep for GOVIM_ERRLOGMATCH_WAIT to ensure we don''t have any errors' | ||
|
||
# Expect the initial state | ||
vim ex 'e main.go' | ||
vimexprwait errors.golden getqflist() | ||
|
||
# Make a change that shouldn't alter the diagnostics | ||
vim call append '[4,"\t"]' | ||
sleep $GOVIM_ERRLOGMATCH_WAIT | ||
vimexprwait errors.golden getqflist() | ||
|
||
# Undo that change and ensure we still have the diagnostics | ||
vim ex 5delete | ||
sleep $GOVIM_ERRLOGMATCH_WAIT | ||
vimexprwait errors.golden getqflist() | ||
|
||
-- go.mod -- | ||
module mod.com | ||
|
||
go 1.12 | ||
-- main.go -- | ||
package main | ||
|
||
func main() { | ||
x := 123 | ||
} | ||
-- errors.golden -- | ||
[ | ||
{ | ||
"bufnr": 1, | ||
"col": 2, | ||
"lnum": 4, | ||
"module": "", | ||
"nr": 0, | ||
"pattern": "", | ||
"text": "x declared but not used", | ||
"type": "", | ||
"valid": 1, | ||
"vcol": 0 | ||
} | ||
] |
46 changes: 46 additions & 0 deletions
46
cmd/govim/testdata/scenario_bugs/bug_gopls_36601_error_no-error_error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# A test that ensures we have a fix for golang.org/issue/36601. Specifically | ||
# that transitions between various states leave diagnostics in the expect state | ||
# when we revert back to the original file contents. | ||
# | ||
# This test moves from error -> no error -> error, i.e. we are making a change | ||
# that should remove diagnostics, then undoing that change to bring them back. | ||
|
||
# Expect the initial state | ||
vim ex 'e main.go' | ||
vimexprwait errors.golden getqflist() | ||
|
||
# Make a change that removes diagnostics | ||
vim call append '[4,"\tprintln(x)"]' | ||
vimexprwait empty.golden getqflist() | ||
|
||
# Undo that change and ensure we have the original diagnostics | ||
vim ex 5delete | ||
vimexprwait errors.golden getqflist() | ||
|
||
-- go.mod -- | ||
module mod.com | ||
|
||
go 1.12 | ||
-- main.go -- | ||
package main | ||
|
||
func main() { | ||
x := 123 | ||
} | ||
-- errors.golden -- | ||
[ | ||
{ | ||
"bufnr": 1, | ||
"col": 2, | ||
"lnum": 4, | ||
"module": "", | ||
"nr": 0, | ||
"pattern": "", | ||
"text": "x declared but not used", | ||
"type": "", | ||
"valid": 1, | ||
"vcol": 0 | ||
} | ||
] | ||
-- empty.golden -- | ||
[] |
50 changes: 50 additions & 0 deletions
50
cmd/govim/testdata/scenario_bugs/bug_gopls_36601_no-error_error_no-error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# A test that ensures we have a fix for golang.org/issue/36601. Specifically | ||
# that transitions between various states leave diagnostics in the expect state | ||
# when we revert back to the original file contents. | ||
# | ||
# This test moves from no error -> error -> no error, i.e. we are making a change | ||
# that should add diagnostics, then undoing that change to remove them. | ||
|
||
[short] skip 'Skip short because we sleep for GOVIM_ERRLOGMATCH_WAIT to ensure we don''t have any errors' | ||
|
||
# Expect the initial state | ||
vim ex 'e main.go' | ||
sleep $GOVIM_ERRLOGMATCH_WAIT | ||
vimexprwait empty.golden getqflist() | ||
|
||
# Make a change that adds diagnostics | ||
vim call append '[4,"\tx := 123"]' | ||
vimexprwait errors.golden getqflist() | ||
|
||
# Undo that change and ensure we still zero diagnostics again | ||
vim ex 5delete | ||
sleep $GOVIM_ERRLOGMATCH_WAIT | ||
vimexprwait empty.golden getqflist() | ||
|
||
-- go.mod -- | ||
module mod.com | ||
|
||
go 1.12 | ||
-- main.go -- | ||
package main | ||
|
||
func main() { | ||
// | ||
} | ||
-- errors.golden -- | ||
[ | ||
{ | ||
"bufnr": 1, | ||
"col": 2, | ||
"lnum": 5, | ||
"module": "", | ||
"nr": 0, | ||
"pattern": "", | ||
"text": "x declared but not used", | ||
"type": "", | ||
"valid": 1, | ||
"vcol": 0 | ||
} | ||
] | ||
-- empty.golden -- | ||
[] |
36 changes: 36 additions & 0 deletions
36
cmd/govim/testdata/scenario_bugs/bug_gopls_36601_no-error_no-error_no-error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# A test that ensures we have a fix for golang.org/issue/36601. Specifically | ||
# that transitions between various states leave diagnostics in the expect state | ||
# when we revert back to the original file contents. | ||
# | ||
# This test moves from no error -> no error -> no error, i.e. we are making a | ||
# change that should not alter the diagnostics, then undoing that change. | ||
|
||
[short] skip 'Skip short because we sleep for GOVIM_ERRLOGMATCH_WAIT to ensure we don''t have any errors' | ||
|
||
# Expect the initial state | ||
vim ex 'e main.go' | ||
sleep $GOVIM_ERRLOGMATCH_WAIT | ||
vimexprwait empty.golden getqflist() | ||
|
||
# Make a change that shouldn't alter the diagnostics | ||
vim call append '[4,"\t"]' | ||
sleep $GOVIM_ERRLOGMATCH_WAIT | ||
vimexprwait empty.golden getqflist() | ||
|
||
# Undo that change and ensure we still have the diagnostics | ||
vim ex 5delete | ||
sleep $GOVIM_ERRLOGMATCH_WAIT | ||
vimexprwait empty.golden getqflist() | ||
|
||
-- go.mod -- | ||
module mod.com | ||
|
||
go 1.12 | ||
-- main.go -- | ||
package main | ||
|
||
func main() { | ||
// | ||
} | ||
-- empty.golden -- | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters