mirror of
https://github.com/golang/go
synced 2024-11-18 19:14:40 -07:00
internal/lsp/source: don't panic compiling regex
This package is basically a library (even though it's internal) and it's generally considered a bad practice for libraries to panic, so don't. Change-Id: I37d9d73ae48ececc6b31436f1076e1f85213f129 Change-Id: I37d9d73ae48ececc6b31436f1076e1f85213f129 GitHub-Last-Rev: 453b538e53e48889171d31829af3304409f9a8bc GitHub-Pull-Request: golang/tools#124 Reviewed-on: https://go-review.googlesource.com/c/tools/+/183680 Reviewed-by: Suzy Mueller <suzmue@golang.org>
This commit is contained in:
parent
3cbd95df51
commit
d1f656545b
@ -85,7 +85,10 @@ func (i *IdentifierInfo) Rename(ctx context.Context, newName string) (map[span.U
|
|||||||
func (r *renamer) update(ctx context.Context) (map[span.URI][]TextEdit, error) {
|
func (r *renamer) update(ctx context.Context) (map[span.URI][]TextEdit, error) {
|
||||||
result := make(map[span.URI][]TextEdit)
|
result := make(map[span.URI][]TextEdit)
|
||||||
|
|
||||||
docRegexp := regexp.MustCompile(`\b` + r.from + `\b`)
|
docRegexp, err := regexp.Compile(`\b` + r.from + `\b`)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
for _, ref := range r.refs {
|
for _, ref := range r.refs {
|
||||||
refSpan, err := ref.Range.Span()
|
refSpan, err := ref.Range.Span()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user