Join GitHub today
x/tools/gopls: handle formatting on files that do not parse #31291
If we don't check a package's parse errors before formatting, we may encounter a case where we delete code on format.
To handle this, we check the parse errors before formatting. However, we should confirm that these errors belong to the file in question and lie within the specified range before failing.
@stamblerre @ianthehat - should/can we also use this issue to pick up the conversation from https://go-review.googlesource.com/c/tools/+/171019/2#message-f8bec621217d3d2caad7dda408cdc629c71aaed6:
Or do you want to capture that discussion about error propagation elsewhere?
Packages with errors may still contain files that can be formatted. Try to format the source of the files in packages that have errors. This change will still not format files with parse errors. Updates golang/go#31291 Change-Id: Ia5168d7908948d201eac7f2ee28534022a2d4eb0 Reviewed-on: https://go-review.googlesource.com/c/tools/+/187757 Run-TryBot: Suzy Mueller <email@example.com> Reviewed-by: Rebecca Stambler <firstname.lastname@example.org>
Updates golang/go#31291 Change-Id: Ibbd0b6cef9b9ec588c8a2e0c5e7ee6e3512b8a22 Reviewed-on: https://go-review.googlesource.com/c/tools/+/188767 Reviewed-by: Ian Cottrell <email@example.com> Run-TryBot: Rebecca Stambler <firstname.lastname@example.org>