Skip to content

Commit 649f485

Browse files
cuishuanggopherbot
authored andcommitted
all: make function and struct comments match the names
Change-Id: Ia7d5c0bb0299d9d898e62740c3e05fc1e5cbf9cd Reviewed-on: https://go-review.googlesource.com/c/tools/+/639477 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Michael Matloob <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]>
1 parent 26d1af2 commit 649f485

File tree

19 files changed

+24
-24
lines changed

19 files changed

+24
-24
lines changed

cmd/bisect/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ type Bisect struct {
262262
// each pattern starts with a !.
263263
Disable bool
264264

265-
// SkipDigits is the number of hex digits to use in skip messages.
265+
// SkipHexDigits is the number of hex digits to use in skip messages.
266266
// If the set of available changes is the same in each run, as it should be,
267267
// then this doesn't matter: we'll only exclude suffixes that uniquely identify
268268
// a given change. But for some programs, especially bisecting runtime

go/packages/packages_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3222,7 +3222,7 @@ func TestIssue70394(t *testing.T) {
32223222
}
32233223
}
32243224

3225-
// TestNeedTypesInfoOnly tests when NeedTypesInfo was set and NeedSyntax & NeedTypes were not,
3225+
// TestLoadTypesInfoWithoutSyntaxOrTypes tests when NeedTypesInfo was set and NeedSyntax & NeedTypes were not,
32263226
// Load should include the TypesInfo of packages properly
32273227
func TestLoadTypesInfoWithoutSyntaxOrTypes(t *testing.T) {
32283228
testAllOrModulesParallel(t, testLoadTypesInfoWithoutSyntaxOrTypes)

gopls/internal/cache/typerefs/pkggraph_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type Package struct {
4040
// transitively reachable through references, starting with the given decl.
4141
transitiveRefs map[string]*typerefs.PackageSet
4242

43-
// ReachesViaDeps records the set of packages in the containing graph whose
43+
// ReachesByDeps records the set of packages in the containing graph whose
4444
// syntax may affect the current package's types. See the package
4545
// documentation for more details of what this means.
4646
ReachesByDeps *typerefs.PackageSet

gopls/internal/golang/codeaction.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func (req *codeActionsRequest) addCommandAction(cmd *protocol.Command, allowReso
172172
req.addAction(act)
173173
}
174174

175-
// addCommandAction adds an edit-based CodeAction to the result.
175+
// addEditAction adds an edit-based CodeAction to the result.
176176
func (req *codeActionsRequest) addEditAction(title string, fixedDiagnostics []protocol.Diagnostic, changes ...protocol.DocumentChange) {
177177
req.addAction(protocol.CodeAction{
178178
Title: title,
@@ -648,7 +648,7 @@ func refactorRewriteChangeQuote(ctx context.Context, req *codeActionsRequest) er
648648
return nil
649649
}
650650

651-
// refactorRewriteChangeQuote produces "Invert 'if' condition" code actions.
651+
// refactorRewriteInvertIf produces "Invert 'if' condition" code actions.
652652
// See [invertIfCondition] for command implementation.
653653
func refactorRewriteInvertIf(ctx context.Context, req *codeActionsRequest) error {
654654
if _, ok, _ := canInvertIfCondition(req.pgf.File, req.start, req.end); ok {

gopls/internal/golang/completion/postfix_snippets.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ type postfixTmplArgs struct {
6969
// Type is the type of "foo.bar" in "foo.bar.print!".
7070
Type types.Type
7171

72-
// FuncResult are results of the enclosed function
72+
// FuncResults are results of the enclosed function
7373
FuncResults []*types.Var
7474

7575
sel *ast.SelectorExpr

gopls/internal/golang/extract.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ var conventionalVarNames = map[objKey]string{
16541654
{"http", "ResponseWriter"}: "rw", // Note: same as [AbbreviateVarName].
16551655
}
16561656

1657-
// varNameForTypeName chooses a "good" name for a variable with the given type,
1657+
// varNameForType chooses a "good" name for a variable with the given type,
16581658
// if possible. Otherwise, it returns "", false.
16591659
//
16601660
// For special types, it uses known conventional names.

gopls/internal/protocol/command/interface.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ type RunVulncheckResult struct {
525525
Token protocol.ProgressToken
526526
}
527527

528-
// GovulncheckResult holds the result of synchronously running the vulncheck
528+
// VulncheckResult holds the result of synchronously running the vulncheck
529529
// command.
530530
type VulncheckResult struct {
531531
// Result holds the result of running vulncheck.
@@ -695,7 +695,7 @@ type PackagesResult struct {
695695
// Packages is an unordered list of package metadata.
696696
Packages []Package
697697

698-
// Modules maps module path to module metadata for
698+
// Module maps module path to module metadata for
699699
// all the modules of the returned Packages.
700700
Module map[string]Module
701701
}

gopls/internal/protocol/generate/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ type Type struct {
112112
Line int `json:"line"` // JSON source line
113113
}
114114

115-
// ParsedLiteral is Type.Value when Type.Kind is "literal"
115+
// ParseLiteral is Type.Value when Type.Kind is "literal"
116116
type ParseLiteral struct {
117117
Properties `json:"properties"`
118118
}

gopls/internal/server/general.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ func (s *server) fileOf(ctx context.Context, uri protocol.DocumentURI) (file.Han
610610
return fh, snapshot, release, nil
611611
}
612612

613-
// shutdown implements the 'shutdown' LSP handler. It releases resources
613+
// Shutdown implements the 'shutdown' LSP handler. It releases resources
614614
// associated with the server and waits for all ongoing work to complete.
615615
func (s *server) Shutdown(ctx context.Context) error {
616616
ctx, done := event.Start(ctx, "lsp.Server.shutdown")

gopls/internal/server/selection_range.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"golang.org/x/tools/internal/event"
1616
)
1717

18-
// selectionRange defines the textDocument/selectionRange feature,
18+
// SelectionRange defines the textDocument/selectionRange feature,
1919
// which, given a list of positions within a file,
2020
// reports a linked list of enclosing syntactic blocks, innermost first.
2121
//

gopls/internal/test/integration/env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ func (a *Awaiter) onShowMessage(_ context.Context, params *protocol.ShowMessageP
225225
return nil
226226
}
227227

228-
// ListenToShownDocuments registers a listener to incoming showDocument
228+
// ListenToShownMessages registers a listener to incoming showMessage
229229
// notifications. Call the resulting func to deregister the listener and
230230
// receive all notifications that have occurred since the listener was
231231
// registered.

gopls/internal/test/integration/expectation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ type WorkStatus struct {
452452
EndMsg string
453453
}
454454

455-
// CompletedProgress expects that workDone progress is complete for the given
455+
// CompletedProgressToken expects that workDone progress is complete for the given
456456
// progress token. When non-nil WorkStatus is provided, it will be filled
457457
// when the expectation is met.
458458
//

gopls/internal/util/moremaps/maps.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func Group[K comparable, V any](s []V, key func(V) K) map[K][]V {
2222
return m
2323
}
2424

25-
// Keys returns the keys of the map M, like slices.Collect(maps.Keys(m)).
25+
// KeySlice returns the keys of the map M, like slices.Collect(maps.Keys(m)).
2626
func KeySlice[M ~map[K]V, K comparable, V any](m M) []K {
2727
r := make([]K, 0, len(m))
2828
for k := range m {

internal/aliases/aliases_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func TestNewAlias(t *testing.T) {
8181
}
8282
}
8383

84-
// TestNewAlias tests that alias.NewAlias can create a parameterized alias
84+
// TestNewParameterizedAlias tests that alias.NewAlias can create a parameterized alias
8585
// A[T] of a type whose underlying and Unaliased type is *T. The test then
8686
// instantiates A[Named] and checks that the underlying and Unaliased type
8787
// of A[Named] is *Named.

internal/event/export/metric/data.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type Int64Data struct {
3434
IsGauge bool
3535
// Rows holds the per group values for the metric.
3636
Rows []int64
37-
// End is the last time this metric was updated.
37+
// EndTime is the last time this metric was updated.
3838
EndTime time.Time
3939

4040
groups [][]label.Label
@@ -49,7 +49,7 @@ type Float64Data struct {
4949
IsGauge bool
5050
// Rows holds the per group values for the metric.
5151
Rows []float64
52-
// End is the last time this metric was updated.
52+
// EndTime is the last time this metric was updated.
5353
EndTime time.Time
5454

5555
groups [][]label.Label
@@ -62,7 +62,7 @@ type HistogramInt64Data struct {
6262
Info *HistogramInt64
6363
// Rows holds the per group values for the metric.
6464
Rows []*HistogramInt64Row
65-
// End is the last time this metric was updated.
65+
// EndTime is the last time this metric was updated.
6666
EndTime time.Time
6767

6868
groups [][]label.Label
@@ -89,7 +89,7 @@ type HistogramFloat64Data struct {
8989
Info *HistogramFloat64
9090
// Rows holds the per group values for the metric.
9191
Rows []*HistogramFloat64Row
92-
// End is the last time this metric was updated.
92+
// EndTime is the last time this metric was updated.
9393
EndTime time.Time
9494

9595
groups [][]label.Label

internal/jsonrpc2/wire.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type wireRequest struct {
4747
ID *ID `json:"id,omitempty"`
4848
}
4949

50-
// WireResponse is a reply to a Request.
50+
// wireResponse is a reply to a Request.
5151
// It will always have the ID field set to tie it back to a request, and will
5252
// have either the Result or Error fields set depending on whether it is a
5353
// success or failure response.

internal/modindex/index.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func writeIndexToFile(x *Index, fd *os.File) error {
244244
// tests can override this
245245
var IndexDir = indexDir
246246

247-
// IndexDir computes the directory containing the index
247+
// indexDir computes the directory containing the index
248248
func indexDir() (string, error) {
249249
dir, err := os.UserCacheDir()
250250
if err != nil {

internal/refactor/inline/callee.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ func isSelectionOperand(stack []ast.Node) bool {
769769
// use of b.
770770
type shadowMap map[string]int
771771

772-
// addShadows returns the [shadowMap] augmented by the set of names
772+
// add returns the [shadowMap] augmented by the set of names
773773
// locally shadowed at the location of the reference in the callee
774774
// (identified by the stack). The name of the reference itself is
775775
// excluded.

internal/testenv/testenv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ func NeedsGo1Point(t testing.TB, x int) {
364364
}
365365
}
366366

367-
// SkipAfterGo1Point skips t if the ambient go command version in the PATH of
367+
// SkipAfterGoCommand1Point skips t if the ambient go command version in the PATH of
368368
// the current process is newer than 1.x.
369369
//
370370
// SkipAfterGoCommand1Point memoizes the result of running the go command, so

0 commit comments

Comments
 (0)