-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal/lsp/source/completion: support postfix completion (iferr,
variferr) Go require explicit error handle, you must check and return error after some function call. These postfix completion can help to write the check error code. The postfix completion iferr replace strconv.Atoi("32").iferr to if _, err := strconv.Atoi("32"); err != nil { return zero1, zero2, err } The postfix completion variferr replace strconv.Atoi("32").variferr to value, err := strconv.Atoi("32"); if err != nil { return zero1, zero2, err } The "zero1", "zero2" represent the zero value of enclosed function results. Fixes golang/go#64178 Change-Id: I8313168514bfdfd22ad03b0228d4ca738ba9e9e3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/550455 Reviewed-by: Robert Findley <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Robert Findley <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
- Loading branch information
Showing
4 changed files
with
217 additions
and
13 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