gopls/internal/golang/stubmethods: rename analysis/stubmethods
Change-Id: I378afe9f961e6a6b3363f464cde198f2ca0bb525
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617255
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/gopls/internal/golang/codeaction.go b/gopls/internal/golang/codeaction.go
index b68b317..3c91662 100644
--- a/gopls/internal/golang/codeaction.go
+++ b/gopls/internal/golang/codeaction.go
@@ -19,10 +19,10 @@
"golang.org/x/tools/go/ast/astutil"
"golang.org/x/tools/gopls/internal/analysis/fillstruct"
"golang.org/x/tools/gopls/internal/analysis/fillswitch"
- "golang.org/x/tools/gopls/internal/analysis/stubmethods"
"golang.org/x/tools/gopls/internal/cache"
"golang.org/x/tools/gopls/internal/cache/parsego"
"golang.org/x/tools/gopls/internal/file"
+ "golang.org/x/tools/gopls/internal/golang/stubmethods"
"golang.org/x/tools/gopls/internal/label"
"golang.org/x/tools/gopls/internal/protocol"
"golang.org/x/tools/gopls/internal/protocol/command"
diff --git a/gopls/internal/golang/hover.go b/gopls/internal/golang/hover.go
index 016222a..a0622fd 100644
--- a/gopls/internal/golang/hover.go
+++ b/gopls/internal/golang/hover.go
@@ -1109,6 +1109,10 @@
// pos; the resulting File and Pos may belong to the same or a
// different FileSet, such as one synthesized by the parser cache, if
// parse-caching is enabled.
+//
+// TODO(adonovan): change this function to accept a filename and a
+// byte offset, and eliminate the confusing (fset, pos) parameters.
+// Then simplify stubmethods.StubInfo, which doesn't need a Fset.
func parseFull(ctx context.Context, snapshot *cache.Snapshot, fset *token.FileSet, pos token.Pos) (*parsego.File, token.Pos, error) {
f := fset.File(pos)
if f == nil {
diff --git a/gopls/internal/golang/stub.go b/gopls/internal/golang/stub.go
index c8a47b6..ca5f005 100644
--- a/gopls/internal/golang/stub.go
+++ b/gopls/internal/golang/stub.go
@@ -18,10 +18,10 @@
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/ast/astutil"
- "golang.org/x/tools/gopls/internal/analysis/stubmethods"
"golang.org/x/tools/gopls/internal/cache"
"golang.org/x/tools/gopls/internal/cache/metadata"
"golang.org/x/tools/gopls/internal/cache/parsego"
+ "golang.org/x/tools/gopls/internal/golang/stubmethods"
"golang.org/x/tools/gopls/internal/util/bug"
"golang.org/x/tools/gopls/internal/util/safetoken"
"golang.org/x/tools/internal/diff"
diff --git a/gopls/internal/analysis/stubmethods/stubmethods.go b/gopls/internal/golang/stubmethods/stubmethods.go
similarity index 96%
rename from gopls/internal/analysis/stubmethods/stubmethods.go
rename to gopls/internal/golang/stubmethods/stubmethods.go
index bfb68a4..ee7b525 100644
--- a/gopls/internal/analysis/stubmethods/stubmethods.go
+++ b/gopls/internal/golang/stubmethods/stubmethods.go
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// Package stubmethods provides the analysis logic for the quick fix
+// to "Declare missing methods of TYPE" errors. (The fix logic lives
+// in golang.stubMethodsFixer.)
package stubmethods
-// TODO(adonovan): rename package to golang/stubmethods or move
-// functions to golang/stub.go.
-
import (
"fmt"
"go/ast"
@@ -14,6 +14,9 @@
"go/types"
)
+// TODO(adonovan): eliminate the confusing Fset parameter; only the
+// file name and byte offset of Concrete are needed.
+
// StubInfo represents a concrete type
// that wants to stub out an interface type
type StubInfo struct {