all: fix some comments

Change-Id: I44a562ec6d71dcf638333a855083f46201ef9a5e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/464236
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
diff --git a/cmd/fiximports/main.go b/cmd/fiximports/main.go
index 515d4a6..8eeacd1 100644
--- a/cmd/fiximports/main.go
+++ b/cmd/fiximports/main.go
@@ -389,7 +389,7 @@
 	return ok
 }
 
-// rewrite reads, modifies, and writes filename, replacing all imports
+// rewriteFile reads, modifies, and writes filename, replacing all imports
 // of packages P in canonical by canonical[P].
 // It records in used which canonical packages were imported.
 // used[P]=="" indicates that P was imported but its canonical path is unknown.
diff --git a/cmd/guru/guru.go b/cmd/guru/guru.go
index 18bb084..7a42aaa 100644
--- a/cmd/guru/guru.go
+++ b/cmd/guru/guru.go
@@ -55,12 +55,12 @@
 	info       *loader.PackageInfo // type info for the queried package (nil for fastQueryPos)
 }
 
-// TypeString prints type T relative to the query position.
+// typeString prints type T relative to the query position.
 func (qpos *queryPos) typeString(T types.Type) string {
 	return types.TypeString(T, types.RelativeTo(qpos.info.Pkg))
 }
 
-// ObjectString prints object obj relative to the query position.
+// objectString prints object obj relative to the query position.
 func (qpos *queryPos) objectString(obj types.Object) string {
 	return types.ObjectString(obj, types.RelativeTo(qpos.info.Pkg))
 }
diff --git a/cmd/guru/referrers.go b/cmd/guru/referrers.go
index 78c8ef9..d75196b 100644
--- a/cmd/guru/referrers.go
+++ b/cmd/guru/referrers.go
@@ -703,7 +703,7 @@
 	refs  []*ast.Ident // set of all other references to it
 }
 
-// forEachRef calls f(id, text) for id in r.refs, in order.
+// foreachRef calls f(id, text) for id in r.refs, in order.
 // Text is the text of the line on which id appears.
 func (r *referrersPackageResult) foreachRef(f func(id *ast.Ident, text string)) {
 	// Show referring lines, like grep.
diff --git a/cmd/signature-fuzzer/fuzz-runner/runner.go b/cmd/signature-fuzzer/fuzz-runner/runner.go
index 4e5b413..b77b218 100644
--- a/cmd/signature-fuzzer/fuzz-runner/runner.go
+++ b/cmd/signature-fuzzer/fuzz-runner/runner.go
@@ -107,7 +107,7 @@
 	return st
 }
 
-// docodmout forks and execs command 'cmd' in dir 'dir', redirecting
+// docmdout forks and execs command 'cmd' in dir 'dir', redirecting
 // stderr and stdout from the execution to file 'outfile'.
 func docmdout(cmd []string, dir string, outfile string) int {
 	of, err := os.OpenFile(outfile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
diff --git a/go/analysis/internal/checker/checker.go b/go/analysis/internal/checker/checker.go
index cf76bde..530d23d 100644
--- a/go/analysis/internal/checker/checker.go
+++ b/go/analysis/internal/checker/checker.go
@@ -929,7 +929,7 @@
 	return t
 }
 
-// allObjectFacts implements Pass.AllObjectFacts.
+// allPackageFacts implements Pass.AllPackageFacts.
 func (act *action) allPackageFacts() []analysis.PackageFact {
 	facts := make([]analysis.PackageFact, 0, len(act.packageFacts))
 	for k := range act.packageFacts {
diff --git a/go/internal/gccgoimporter/parser.go b/go/internal/gccgoimporter/parser.go
index 5c24845..9fdb6f8 100644
--- a/go/internal/gccgoimporter/parser.go
+++ b/go/internal/gccgoimporter/parser.go
@@ -1167,7 +1167,7 @@
 	}
 }
 
-// parseInitDateDirective parses an InitDataDirective:
+// parseInitDataDirective parses an InitDataDirective:
 //
 //	InitDataDirective = ( "v1" | "v2" | "v3" ) ";" |
 //		"priority" int ";" |
diff --git a/go/pointer/api.go b/go/pointer/api.go
index 64de110..8c9a8c7 100644
--- a/go/pointer/api.go
+++ b/go/pointer/api.go
@@ -97,7 +97,7 @@
 	c.Queries[v] = struct{}{}
 }
 
-// AddQuery adds v to Config.IndirectQueries.
+// AddIndirectQuery adds v to Config.IndirectQueries.
 // Precondition: CanPoint(v.Type().Underlying().(*types.Pointer).Elem()).
 func (c *Config) AddIndirectQuery(v ssa.Value) {
 	if c.IndirectQueries == nil {
diff --git a/go/pointer/gen.go b/go/pointer/gen.go
index bee656b..5e527f2 100644
--- a/go/pointer/gen.go
+++ b/go/pointer/gen.go
@@ -206,7 +206,7 @@
 	return id
 }
 
-// rtypeValue returns the type of the *reflect.rtype-tagged object obj.
+// rtypeTaggedValue returns the type of the *reflect.rtype-tagged object obj.
 func (a *analysis) rtypeTaggedValue(obj nodeid) types.Type {
 	tDyn, t, _ := a.taggedValue(obj)
 	if tDyn != a.reflectRtypePtr {
diff --git a/go/ssa/instantiate.go b/go/ssa/instantiate.go
index f73594b..f6b2533 100644
--- a/go/ssa/instantiate.go
+++ b/go/ssa/instantiate.go
@@ -12,7 +12,7 @@
 	"golang.org/x/tools/internal/typeparams"
 )
 
-// Instances returns all of the instances generated by runtime types for this function in an unspecified order.
+// _Instances returns all of the instances generated by runtime types for this function in an unspecified order.
 //
 // Thread-safe.
 //
diff --git a/go/ssa/util.go b/go/ssa/util.go
index 6b0aada..aef57dc 100644
--- a/go/ssa/util.go
+++ b/go/ssa/util.go
@@ -83,7 +83,7 @@
 	return false
 }
 
-// isBasicConvType returns true when a type set can be
+// isBasicConvTypes returns true when a type set can be
 // one side of a Convert operation. This is when:
 // - All are basic, []byte, or []rune.
 // - At least 1 is basic.
diff --git a/godoc/index.go b/godoc/index.go
index 4dc3362..4471f59 100644
--- a/godoc/index.go
+++ b/godoc/index.go
@@ -1422,7 +1422,7 @@
 	return
 }
 
-// InvalidateIndex should be called whenever any of the file systems
+// invalidateIndex should be called whenever any of the file systems
 // under godoc's observation change so that the indexer is kicked on.
 func (c *Corpus) invalidateIndex() {
 	c.fsModified.Set(nil)
diff --git a/godoc/meta.go b/godoc/meta.go
index 751b72e..76a2750 100644
--- a/godoc/meta.go
+++ b/godoc/meta.go
@@ -60,7 +60,7 @@
 	return
 }
 
-// UpdateMetadata scans $GOROOT/doc for HTML and Markdown files, reads their metadata,
+// updateMetadata scans $GOROOT/doc for HTML and Markdown files, reads their metadata,
 // and updates the DocMetadata map.
 func (c *Corpus) updateMetadata() {
 	metadata := make(map[string]*Metadata)
@@ -147,7 +147,7 @@
 	}
 }
 
-// RefreshMetadataLoop runs forever, updating DocMetadata when the underlying
+// refreshMetadataLoop runs forever, updating DocMetadata when the underlying
 // file system changes. It should be launched in a goroutine.
 func (c *Corpus) refreshMetadataLoop() {
 	for {
diff --git a/gopls/internal/lsp/cache/load.go b/gopls/internal/lsp/cache/load.go
index 9b321ce..98a8fec 100644
--- a/gopls/internal/lsp/cache/load.go
+++ b/gopls/internal/lsp/cache/load.go
@@ -274,7 +274,7 @@
 	return buf.String()
 }
 
-// workspaceLayoutErrors returns an error decribing a misconfiguration of the
+// workspaceLayoutError returns an error describing a misconfiguration of the
 // workspace, along with related diagnostic.
 //
 // The unusual argument ordering of results is intentional: if the resulting
diff --git a/gopls/internal/lsp/cache/mod.go b/gopls/internal/lsp/cache/mod.go
index 9244f69..4a3d8db 100644
--- a/gopls/internal/lsp/cache/mod.go
+++ b/gopls/internal/lsp/cache/mod.go
@@ -285,7 +285,7 @@
 	return why, nil
 }
 
-// extractGoCommandError tries to parse errors that come from the go command
+// extractGoCommandErrors tries to parse errors that come from the go command
 // and shape them into go.mod diagnostics.
 // TODO: rename this to 'load errors'
 func (s *snapshot) extractGoCommandErrors(ctx context.Context, goCmdError error) []*source.Diagnostic {
diff --git a/gopls/internal/lsp/cmd/cmd.go b/gopls/internal/lsp/cmd/cmd.go
index 96d43d3..74725f7 100644
--- a/gopls/internal/lsp/cmd/cmd.go
+++ b/gopls/internal/lsp/cmd/cmd.go
@@ -229,7 +229,7 @@
 	return tool.CommandLineErrorf("Unknown command %v", command)
 }
 
-// commands returns the set of commands supported by the gopls tool on the
+// Commands returns the set of commands supported by the gopls tool on the
 // command line.
 // The command is specified by the first non flag argument.
 func (app *Application) Commands() []tool.Application {
diff --git a/gopls/internal/lsp/debug/serve.go b/gopls/internal/lsp/debug/serve.go
index 3e6a905..e79e88c 100644
--- a/gopls/internal/lsp/debug/serve.go
+++ b/gopls/internal/lsp/debug/serve.go
@@ -192,14 +192,14 @@
 	ClientID     string
 }
 
-// AddClient adds a client to the set being served.
+// addClient adds a client to the set being served.
 func (st *State) addClient(session *cache.Session) {
 	st.mu.Lock()
 	defer st.mu.Unlock()
 	st.clients = append(st.clients, &Client{Session: session})
 }
 
-// DropClient removes a client from the set being served.
+// dropClient removes a client from the set being served.
 func (st *State) dropClient(session *cache.Session) {
 	st.mu.Lock()
 	defer st.mu.Unlock()
@@ -213,7 +213,7 @@
 	}
 }
 
-// AddServer adds a server to the set being queried. In practice, there should
+// updateServer updates a server to the set being queried. In practice, there should
 // be at most one remote server.
 func (st *State) updateServer(server *Server) {
 	st.mu.Lock()
@@ -232,7 +232,7 @@
 	st.servers = append(st.servers, server)
 }
 
-// DropServer drops a server from the set being queried.
+// dropServer drops a server from the set being queried.
 func (st *State) dropServer(id string) {
 	st.mu.Lock()
 	defer st.mu.Unlock()
diff --git a/gopls/internal/lsp/fake/editor.go b/gopls/internal/lsp/fake/editor.go
index 0807440..1e5b079 100644
--- a/gopls/internal/lsp/fake/editor.go
+++ b/gopls/internal/lsp/fake/editor.go
@@ -793,7 +793,7 @@
 	return e.extractFirstLocation(ctx, resp)
 }
 
-// extractFirstPathAndPos returns the first location.
+// extractFirstLocation returns the first location.
 // It opens the file if needed.
 func (e *Editor) extractFirstLocation(ctx context.Context, locs []protocol.Location) (protocol.Location, error) {
 	if len(locs) == 0 {
diff --git a/gopls/internal/lsp/progress/progress.go b/gopls/internal/lsp/progress/progress.go
index 31a8cb6..32ac911 100644
--- a/gopls/internal/lsp/progress/progress.go
+++ b/gopls/internal/lsp/progress/progress.go
@@ -12,9 +12,9 @@
 	"strings"
 	"sync"
 
+	"golang.org/x/tools/gopls/internal/lsp/protocol"
 	"golang.org/x/tools/internal/event"
 	"golang.org/x/tools/internal/event/tag"
-	"golang.org/x/tools/gopls/internal/lsp/protocol"
 	"golang.org/x/tools/internal/xcontext"
 )
 
@@ -167,7 +167,7 @@
 	}
 }
 
-// report reports an update on WorkDone report back to the client.
+// Report reports an update on WorkDone report back to the client.
 func (wd *WorkDone) Report(ctx context.Context, message string, percentage float64) {
 	ctx = xcontext.Detach(ctx) // progress messages should not be cancelled
 	if wd == nil {
@@ -202,7 +202,7 @@
 	}
 }
 
-// end reports a workdone completion back to the client.
+// End reports a workdone completion back to the client.
 func (wd *WorkDone) End(ctx context.Context, message string) {
 	ctx = xcontext.Detach(ctx) // progress messages should not be cancelled
 	if wd == nil {
diff --git a/gopls/internal/lsp/protocol/mapper.go b/gopls/internal/lsp/protocol/mapper.go
index 6a93c39..a0f1172 100644
--- a/gopls/internal/lsp/protocol/mapper.go
+++ b/gopls/internal/lsp/protocol/mapper.go
@@ -419,7 +419,7 @@
 	return m.OffsetPosition(offset)
 }
 
-// PosPosition converts a token range to a protocol (UTF-16) location.
+// PosLocation converts a token range to a protocol (UTF-16) location.
 func (m *Mapper) PosLocation(tf *token.File, start, end token.Pos) (Location, error) {
 	startOffset, endOffset, err := safetoken.Offsets(tf, start, end)
 	if err != nil {
@@ -432,7 +432,7 @@
 	return m.RangeLocation(rng), nil
 }
 
-// PosPosition converts a token range to a protocol (UTF-16) range.
+// PosRange converts a token range to a protocol (UTF-16) range.
 func (m *Mapper) PosRange(tf *token.File, start, end token.Pos) (Range, error) {
 	startOffset, endOffset, err := safetoken.Offsets(tf, start, end)
 	if err != nil {
diff --git a/gopls/internal/lsp/source/completion/snippet.go b/gopls/internal/lsp/source/completion/snippet.go
index 5357723..f4ea767 100644
--- a/gopls/internal/lsp/source/completion/snippet.go
+++ b/gopls/internal/lsp/source/completion/snippet.go
@@ -11,7 +11,7 @@
 	"golang.org/x/tools/gopls/internal/lsp/snippet"
 )
 
-// structFieldSnippets calculates the snippet for struct literal field names.
+// structFieldSnippet calculates the snippet for struct literal field names.
 func (c *completer) structFieldSnippet(cand candidate, detail string, snip *snippet.Builder) {
 	if !c.wantStructFieldCompletions() {
 		return
@@ -49,7 +49,7 @@
 	}
 }
 
-// functionCallSnippets calculates the snippet for function calls.
+// functionCallSnippet calculates the snippet for function calls.
 func (c *completer) functionCallSnippet(name string, tparams, params []string, snip *snippet.Builder) {
 	// If there is no suffix then we need to reuse existing call parens
 	// "()" if present. If there is an identifier suffix then we always
diff --git a/gopls/internal/lsp/source/rename_check.go b/gopls/internal/lsp/source/rename_check.go
index 5495e6a..d01d228 100644
--- a/gopls/internal/lsp/source/rename_check.go
+++ b/gopls/internal/lsp/source/rename_check.go
@@ -441,7 +441,7 @@
 	r.checkSelections(from)
 }
 
-// checkSelection checks that all uses and selections that resolve to
+// checkSelections checks that all uses and selections that resolve to
 // the specified object would continue to do so after the renaming.
 func (r *renamer) checkSelections(from types.Object) {
 	for typ, pkg := range r.packages {
diff --git a/gopls/internal/lsp/source/view.go b/gopls/internal/lsp/source/view.go
index c581286..2227c5c 100644
--- a/gopls/internal/lsp/source/view.go
+++ b/gopls/internal/lsp/source/view.go
@@ -419,7 +419,7 @@
 	return pgf.Mapper.PosLocation(pgf.Tok, node.Pos(), node.End())
 }
 
-// RangeToSpanRange parses a protocol Range back into the go/token domain.
+// RangeToTokenRange parses a protocol Range back into the go/token domain.
 func (pgf *ParsedGoFile) RangeToTokenRange(r protocol.Range) (safetoken.Range, error) {
 	start, end, err := pgf.Mapper.RangeOffsets(r)
 	if err != nil {
diff --git a/internal/gcimporter/iexport.go b/internal/gcimporter/iexport.go
index 5e01184..8bd51ec 100644
--- a/internal/gcimporter/iexport.go
+++ b/internal/gcimporter/iexport.go
@@ -369,7 +369,7 @@
 	return off
 }
 
-// fileIndex returns the index of the token.File and the byte offset of pos within it.
+// fileIndexAndOffset returns the index of the token.File and the byte offset of pos within it.
 func (p *iexporter) fileIndexAndOffset(file *token.File, pos token.Pos) (uint64, uint64) {
 	index, ok := p.fileInfo[file]
 	if !ok {
diff --git a/internal/pkgbits/decoder.go b/internal/pkgbits/decoder.go
index 3205c9a..b92e8e6 100644
--- a/internal/pkgbits/decoder.go
+++ b/internal/pkgbits/decoder.go
@@ -373,7 +373,7 @@
 	return r.rawVarint()
 }
 
-// Int64 decodes and returns a uint64 value from the element bitstream.
+// Uint64 decodes and returns a uint64 value from the element bitstream.
 func (r *Decoder) Uint64() uint64 {
 	r.Sync(SyncUint64)
 	return r.rawUvarint()
diff --git a/internal/pkgbits/encoder.go b/internal/pkgbits/encoder.go
index e98e411..6482617 100644
--- a/internal/pkgbits/encoder.go
+++ b/internal/pkgbits/encoder.go
@@ -293,7 +293,7 @@
 // Int encodes and writes an int value into the element bitstream.
 func (w *Encoder) Int(x int) { w.Int64(int64(x)) }
 
-// Len encodes and writes a uint value into the element bitstream.
+// Uint encodes and writes a uint value into the element bitstream.
 func (w *Encoder) Uint(x uint) { w.Uint64(uint64(x)) }
 
 // Reloc encodes and writes a relocation for the given (section,
diff --git a/refactor/rename/check.go b/refactor/rename/check.go
index 7a0627b..9f29b98 100644
--- a/refactor/rename/check.go
+++ b/refactor/rename/check.go
@@ -478,7 +478,7 @@
 	r.checkSelections(from)
 }
 
-// checkSelection checks that all uses and selections that resolve to
+// checkSelections checks that all uses and selections that resolve to
 // the specified object would continue to do so after the renaming.
 func (r *renamer) checkSelections(from types.Object) {
 	for pkg, info := range r.packages {