Skip to content

Commit

Permalink
gopls/internal/golang/stubmethods: rename analysis/stubmethods
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
adonovan authored and gopherbot committed Oct 4, 2024
1 parent efd951d commit 2683c79
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gopls/internal/golang/codeaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
"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"
Expand Down
4 changes: 4 additions & 0 deletions gopls/internal/golang/hover.go
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,10 @@ func chooseDocComment(decl ast.Decl, spec ast.Spec, field *ast.Field) *ast.Comme
// 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 {
Expand Down
2 changes: 1 addition & 1 deletion gopls/internal/golang/stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (

"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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
// 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"
"go/token"
"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 {
Expand Down

0 comments on commit 2683c79

Please sign in to comment.