Skip to content

Commit 2f9c834

Browse files
committed
change wording
1 parent 44670c7 commit 2f9c834

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

gopls/internal/golang/codeaction.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ func quickFix(ctx context.Context, req *codeActionsRequest) error {
333333
req.addApplyFixAction(msg, fixMissingCalledFunction, req.loc)
334334
}
335335

336-
// "undeclared name: x" or "undefined: x" compiler error.
337-
// Offer a "Create variable/function x" code action.
338-
// See [fixUndeclared] for command implementation.
336+
// "undeclared name: X" or "undefined: X" compiler error.
337+
// Offer a "Create variable/function X" code action.
338+
// See [createUndeclared] for command implementation.
339339
case strings.HasPrefix(msg, "undeclared name: "),
340340
strings.HasPrefix(msg, "undefined: "):
341341
path, _ := astutil.PathEnclosingInterval(req.pgf.File, start, end)

gopls/internal/golang/fix.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func ApplyFix(ctx context.Context, fix string, snapshot *cache.Snapshot, fh file
110110
fixInvertIfCondition: singleFile(invertIfCondition),
111111
fixSplitLines: singleFile(splitLines),
112112
fixJoinLines: singleFile(joinLines),
113-
fixCreateUndeclared: singleFile(CreateUndeclared),
113+
fixCreateUndeclared: singleFile(createUndeclared),
114114
fixMissingInterfaceMethods: stubMissingInterfaceMethodsFixer,
115115
fixMissingCalledFunction: stubMissingCalledFunctionFixer,
116116
}

gopls/internal/golang/undeclared.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ func undeclaredFixTitle(path []ast.Node, errMsg string) string {
6969
return fmt.Sprintf("Create %s %s", noun, name)
7070
}
7171

72-
// CreateUndeclared generates a suggested declaration for an undeclared variable or function.
73-
func CreateUndeclared(fset *token.FileSet, start, end token.Pos, content []byte, file *ast.File, pkg *types.Package, info *types.Info) (*token.FileSet, *analysis.SuggestedFix, error) {
72+
// createUndeclared generates a suggested declaration for an undeclared variable or function.
73+
func createUndeclared(fset *token.FileSet, start, end token.Pos, content []byte, file *ast.File, pkg *types.Package, info *types.Info) (*token.FileSet, *analysis.SuggestedFix, error) {
7474
pos := start // don't use the end
7575
path, _ := astutil.PathEnclosingInterval(file, pos, pos)
7676
if len(path) < 2 {

0 commit comments

Comments
 (0)