mirror of
https://github.com/golang/go
synced 2024-11-18 16:44:43 -07:00
internal/lsp/source: fix crash on conflict markers in imports
Generally speaking, if the imports package can operate on a file, we can assume that it's in good enough shape for the rest of our work. That means it's important we run imports first. On one code path, we weren't. Fixes golang/go#36162. Change-Id: I750aff31e0c3706aeb798ceb60c35ea17ba95943 Reviewed-on: https://go-review.googlesource.com/c/tools/+/211580 Run-TryBot: Heschi Kreinick <heschi@google.com> Reviewed-by: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
1d943b0903
commit
846828e8ce
@ -132,13 +132,13 @@ func computeImportEdits(ctx context.Context, view View, ph ParseGoHandle, option
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
origImports, origImportOffset := trimToImports(view.Session().Cache().FileSet(), origAST, origData)
|
||||
|
||||
allFixes, err := imports.FixImports(filename, origData, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
origImports, origImportOffset := trimToImports(view.Session().Cache().FileSet(), origAST, origData)
|
||||
allFixEdits, err = computeFixEdits(view, ph, options, origData, origAST, origMapper, origImports, origImportOffset, allFixes)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user