Skip to content

Commit 2683c79

Browse files
adonovangopherbot
authored andcommitted
gopls/internal/golang/stubmethods: rename analysis/stubmethods
Change-Id: I378afe9f961e6a6b3363f464cde198f2ca0bb525 Reviewed-on: https://go-review.googlesource.com/c/tools/+/617255 Reviewed-by: Robert Findley <[email protected]> Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent efd951d commit 2683c79

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

gopls/internal/golang/codeaction.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import (
1919
"golang.org/x/tools/go/ast/astutil"
2020
"golang.org/x/tools/gopls/internal/analysis/fillstruct"
2121
"golang.org/x/tools/gopls/internal/analysis/fillswitch"
22-
"golang.org/x/tools/gopls/internal/analysis/stubmethods"
2322
"golang.org/x/tools/gopls/internal/cache"
2423
"golang.org/x/tools/gopls/internal/cache/parsego"
2524
"golang.org/x/tools/gopls/internal/file"
25+
"golang.org/x/tools/gopls/internal/golang/stubmethods"
2626
"golang.org/x/tools/gopls/internal/label"
2727
"golang.org/x/tools/gopls/internal/protocol"
2828
"golang.org/x/tools/gopls/internal/protocol/command"

gopls/internal/golang/hover.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,10 @@ func chooseDocComment(decl ast.Decl, spec ast.Spec, field *ast.Field) *ast.Comme
11091109
// pos; the resulting File and Pos may belong to the same or a
11101110
// different FileSet, such as one synthesized by the parser cache, if
11111111
// parse-caching is enabled.
1112+
//
1113+
// TODO(adonovan): change this function to accept a filename and a
1114+
// byte offset, and eliminate the confusing (fset, pos) parameters.
1115+
// Then simplify stubmethods.StubInfo, which doesn't need a Fset.
11121116
func parseFull(ctx context.Context, snapshot *cache.Snapshot, fset *token.FileSet, pos token.Pos) (*parsego.File, token.Pos, error) {
11131117
f := fset.File(pos)
11141118
if f == nil {

gopls/internal/golang/stub.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ import (
1818

1919
"golang.org/x/tools/go/analysis"
2020
"golang.org/x/tools/go/ast/astutil"
21-
"golang.org/x/tools/gopls/internal/analysis/stubmethods"
2221
"golang.org/x/tools/gopls/internal/cache"
2322
"golang.org/x/tools/gopls/internal/cache/metadata"
2423
"golang.org/x/tools/gopls/internal/cache/parsego"
24+
"golang.org/x/tools/gopls/internal/golang/stubmethods"
2525
"golang.org/x/tools/gopls/internal/util/bug"
2626
"golang.org/x/tools/gopls/internal/util/safetoken"
2727
"golang.org/x/tools/internal/diff"

gopls/internal/analysis/stubmethods/stubmethods.go renamed to gopls/internal/golang/stubmethods/stubmethods.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
// Package stubmethods provides the analysis logic for the quick fix
6+
// to "Declare missing methods of TYPE" errors. (The fix logic lives
7+
// in golang.stubMethodsFixer.)
58
package stubmethods
69

7-
// TODO(adonovan): rename package to golang/stubmethods or move
8-
// functions to golang/stub.go.
9-
1010
import (
1111
"fmt"
1212
"go/ast"
1313
"go/token"
1414
"go/types"
1515
)
1616

17+
// TODO(adonovan): eliminate the confusing Fset parameter; only the
18+
// file name and byte offset of Concrete are needed.
19+
1720
// StubInfo represents a concrete type
1821
// that wants to stub out an interface type
1922
type StubInfo struct {

0 commit comments

Comments
 (0)