Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/lsp: handle panics due to line numbers in fillstruct
Change-Id: I90f3fd2daf180705048d494476acac5a213f5fb3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/239751 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Baum <joshbaum@google.com>
- Loading branch information
1 parent
88f3c62
commit aa12c9e
Showing
4 changed files
with
43 additions
and
11 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
5 changes: 4 additions & 1 deletion
5
internal/lsp/testdata/lsp/primarymod/fillstruct/fill_struct_package.go
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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
package fillstruct | ||
|
||
import ( | ||
h2 "net/http" | ||
|
||
"golang.org/x/tools/internal/lsp/fillstruct/data" | ||
) | ||
|
||
func unexported() { | ||
a := data.A{} //@suggestedfix("}", "refactor.rewrite") | ||
a := data.A{} //@suggestedfix("}", "refactor.rewrite") | ||
_ = h2.Client{} //@suggestedfix("}", "refactor.rewrite") | ||
} |
23 changes: 22 additions & 1 deletion
23
internal/lsp/testdata/lsp/primarymod/fillstruct/fill_struct_package.go.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,34 @@ | ||
-- suggestedfix_fill_struct_package_8_14 -- | ||
-- suggestedfix_fill_struct_package_10_14 -- | ||
package fillstruct | ||
|
||
import ( | ||
h2 "net/http" | ||
|
||
"golang.org/x/tools/internal/lsp/fillstruct/data" | ||
) | ||
|
||
func unexported() { | ||
a := data.A{ | ||
ExportedInt: 0, | ||
} //@suggestedfix("}", "refactor.rewrite") | ||
_ = h2.Client{} //@suggestedfix("}", "refactor.rewrite") | ||
} | ||
|
||
-- suggestedfix_fill_struct_package_11_16 -- | ||
package fillstruct | ||
|
||
import ( | ||
h2 "net/http" | ||
|
||
"golang.org/x/tools/internal/lsp/fillstruct/data" | ||
) | ||
|
||
func unexported() { | ||
a := data.A{} //@suggestedfix("}", "refactor.rewrite") | ||
_ = h2.Client{ | ||
Transport: nil, | ||
Jar: nil, | ||
Timeout: 0, | ||
} //@suggestedfix("}", "refactor.rewrite") | ||
} | ||
|
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