gopls/internal/golang: use slices.Reverse in pathEnclosingObjNode Change-Id: I1ffa1708564a87125cc38355baf481c3ea6b85b8 Reviewed-on: https://go-review.googlesource.com/c/tools/+/652016 Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/gopls/internal/golang/implementation.go b/gopls/internal/golang/implementation.go index 2d9a1e9..0ccab64 100644 --- a/gopls/internal/golang/implementation.go +++ b/gopls/internal/golang/implementation.go
@@ -665,6 +665,7 @@ // handled this by calling astutil.PathEnclosingInterval twice, // once for "pos" and once for "pos-1". found = n.Pos() <= pos && pos <= n.End() + case *ast.ImportSpec: if n.Path.Pos() <= pos && pos < n.Path.End() { found = true @@ -674,6 +675,7 @@ path = append(path, n.Name) } } + case *ast.StarExpr: // Follow star expressions to the inner identifier. if pos == n.Star { @@ -690,7 +692,6 @@ // Reverse path so leaf is first element. slices.Reverse(path) - return path }