tools: fix typos in docs and comments

Change-Id: I24d372c18122805b14c4f1214a7e18345397af9e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/644136
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
diff --git a/cmd/file2fuzz/main.go b/cmd/file2fuzz/main.go
index c2b7ee5..2a86c2e 100644
--- a/cmd/file2fuzz/main.go
+++ b/cmd/file2fuzz/main.go
@@ -13,7 +13,7 @@
 // output to stdout. If any position arguments are provided stdin is ignored
 // and the arguments are assumed to be input files to convert.
 //
-// The -o flag provides an path to write output files to. If only one positional
+// The -o flag provides a path to write output files to. If only one positional
 // argument is specified it may be a file path or an existing directory, if there are
 // multiple inputs specified it must be a directory. If a directory is provided
 // the name of the file will be the SHA-256 hash of its contents.
diff --git a/go/analysis/passes/pkgfact/pkgfact.go b/go/analysis/passes/pkgfact/pkgfact.go
index 4bf33d4..077c878 100644
--- a/go/analysis/passes/pkgfact/pkgfact.go
+++ b/go/analysis/passes/pkgfact/pkgfact.go
@@ -45,7 +45,7 @@
 }
 
 // A pairsFact is a package-level fact that records
-// an set of key=value strings accumulated from constant
+// a set of key=value strings accumulated from constant
 // declarations in this package and its dependencies.
 // Elements are ordered by keys, which are unique.
 type pairsFact []string
diff --git a/go/analysis/passes/unreachable/doc.go b/go/analysis/passes/unreachable/doc.go
index d17d0d9..325a153 100644
--- a/go/analysis/passes/unreachable/doc.go
+++ b/go/analysis/passes/unreachable/doc.go
@@ -9,6 +9,6 @@
 // unreachable: check for unreachable code
 //
 // The unreachable analyzer finds statements that execution can never reach
-// because they are preceded by an return statement, a call to panic, an
+// because they are preceded by a return statement, a call to panic, an
 // infinite loop, or similar constructs.
 package unreachable
diff --git a/go/callgraph/vta/propagation_test.go b/go/callgraph/vta/propagation_test.go
index 1a274f3..492258f 100644
--- a/go/callgraph/vta/propagation_test.go
+++ b/go/callgraph/vta/propagation_test.go
@@ -336,7 +336,7 @@
 				"Local(t2)": "A;B;C",
 			},
 		},
-		// The outer loop of subsumed-scc pushes A an B through the graph.
+		// The outer loop of subsumed-scc pushes A and B through the graph.
 		{name: "subsumed-scc", graph: suite["subsumed-scc"],
 			want: map[string]string{
 				"Local(t0)": "A;B",
diff --git a/go/expect/extract.go b/go/expect/extract.go
index 1ca67d2..902b1e8 100644
--- a/go/expect/extract.go
+++ b/go/expect/extract.go
@@ -21,7 +21,7 @@
 const commentStart = "@"
 const commentStartLen = len(commentStart)
 
-// Identifier is the type for an identifier in an Note argument list.
+// Identifier is the type for an identifier in a Note argument list.
 type Identifier string
 
 // Parse collects all the notes present in a file.
diff --git a/go/loader/loader_test.go b/go/loader/loader_test.go
index 4729ba3..2276b49 100644
--- a/go/loader/loader_test.go
+++ b/go/loader/loader_test.go
@@ -558,7 +558,7 @@
 // - TypeCheckFuncBodies hook
 
 func TestTransitivelyErrorFreeFlag(t *testing.T) {
-	// Create an minimal custom build.Context
+	// Create a minimal custom build.Context
 	// that fakes the following packages:
 	//
 	// a --> b --> c!   c has an error
diff --git a/go/packages/packagestest/expect.go b/go/packages/packagestest/expect.go
index 14a6446..dc41894 100644
--- a/go/packages/packagestest/expect.go
+++ b/go/packages/packagestest/expect.go
@@ -411,7 +411,7 @@
 			eof := tokFile.Pos(tokFile.Size())
 			return newRange(tokFile, eof, eof), args, nil
 		default:
-			// look up an marker by name
+			// look up a marker by name
 			mark, ok := e.markers[string(arg)]
 			if !ok {
 				return Range{}, nil, fmt.Errorf("cannot find marker %v", arg)
diff --git a/go/ssa/builder_test.go b/go/ssa/builder_test.go
index 59d8a91..2589cc8 100644
--- a/go/ssa/builder_test.go
+++ b/go/ssa/builder_test.go
@@ -214,7 +214,7 @@
 		input string
 		want  []string
 	}{
-		// An package-level type is needed.
+		// A package-level type is needed.
 		{`package A; type T struct{}; func (T) f() {}; var x any = T{}`,
 			[]string{"*p.T", "p.T"},
 		},
diff --git a/go/ssa/emit.go b/go/ssa/emit.go
index edd2ced..a3d41ad 100644
--- a/go/ssa/emit.go
+++ b/go/ssa/emit.go
@@ -18,7 +18,7 @@
 // emitAlloc emits to f a new Alloc instruction allocating a variable
 // of type typ.
 //
-// The caller must set Alloc.Heap=true (for an heap-allocated variable)
+// The caller must set Alloc.Heap=true (for a heap-allocated variable)
 // or add the Alloc to f.Locals (for a frame-allocated variable).
 //
 // During building, a variable in f.Locals may have its Heap flag
diff --git a/gopls/doc/analyzers.md b/gopls/doc/analyzers.md
index 04b9140..aa0081d 100644
--- a/gopls/doc/analyzers.md
+++ b/gopls/doc/analyzers.md
@@ -912,7 +912,7 @@
 
 
 The unreachable analyzer finds statements that execution can never reach
-because they are preceded by an return statement, a call to panic, an
+because they are preceded by a return statement, a call to panic, an
 infinite loop, or similar constructs.
 
 Default: on.
diff --git a/gopls/doc/generate/generate.go b/gopls/doc/generate/generate.go
index 42d41bb..b0d3e8c 100644
--- a/gopls/doc/generate/generate.go
+++ b/gopls/doc/generate/generate.go
@@ -414,7 +414,7 @@
 	return string(defBytes), err
 }
 
-// valueDoc transforms a docstring documenting an constant identifier to a
+// valueDoc transforms a docstring documenting a constant identifier to a
 // docstring documenting its value.
 //
 // If doc is of the form "Foo is a bar", it returns '`"fooValue"` is a bar'. If
diff --git a/gopls/internal/cache/diagnostics.go b/gopls/internal/cache/diagnostics.go
index 68c1632..d43c2f3 100644
--- a/gopls/internal/cache/diagnostics.go
+++ b/gopls/internal/cache/diagnostics.go
@@ -31,7 +31,7 @@
 
 func byURI(d *Diagnostic) protocol.DocumentURI { return d.URI } // For use in maps.Group.
 
-// An Diagnostic corresponds to an LSP Diagnostic.
+// A Diagnostic corresponds to an LSP Diagnostic.
 // https://microsoft.github.io/language-server-protocol/specification#diagnostic
 //
 // It is (effectively) gob-serializable; see {encode,decode}Diagnostics.
diff --git a/gopls/internal/doc/api.json b/gopls/internal/doc/api.json
index 0ae6103..0439072 100644
--- a/gopls/internal/doc/api.json
+++ b/gopls/internal/doc/api.json
@@ -615,7 +615,7 @@
 						},
 						{
 							"Name": "\"unreachable\"",
-							"Doc": "check for unreachable code\n\nThe unreachable analyzer finds statements that execution can never reach\nbecause they are preceded by an return statement, a call to panic, an\ninfinite loop, or similar constructs.",
+							"Doc": "check for unreachable code\n\nThe unreachable analyzer finds statements that execution can never reach\nbecause they are preceded by a return statement, a call to panic, an\ninfinite loop, or similar constructs.",
 							"Default": "true"
 						},
 						{
@@ -1310,7 +1310,7 @@
 		},
 		{
 			"Name": "unreachable",
-			"Doc": "check for unreachable code\n\nThe unreachable analyzer finds statements that execution can never reach\nbecause they are preceded by an return statement, a call to panic, an\ninfinite loop, or similar constructs.",
+			"Doc": "check for unreachable code\n\nThe unreachable analyzer finds statements that execution can never reach\nbecause they are preceded by a return statement, a call to panic, an\ninfinite loop, or similar constructs.",
 			"URL": "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/unreachable",
 			"Default": true
 		},
diff --git a/gopls/internal/server/rename.go b/gopls/internal/server/rename.go
index cdfb9c7..b6fac8b 100644
--- a/gopls/internal/server/rename.go
+++ b/gopls/internal/server/rename.go
@@ -31,7 +31,7 @@
 	}
 
 	// Because we don't handle directory renaming within golang.Rename, golang.Rename returns
-	// boolean value isPkgRenaming to determine whether an DocumentChanges of type RenameFile should
+	// boolean value isPkgRenaming to determine whether any DocumentChanges of type RenameFile should
 	// be added to the return protocol.WorkspaceEdit value.
 	edits, isPkgRenaming, err := golang.Rename(ctx, snapshot, fh, params.Position, params.NewName)
 	if err != nil {
diff --git a/gopls/internal/test/integration/bench/repo_test.go b/gopls/internal/test/integration/bench/repo_test.go
index 0e86f3e..50370e7 100644
--- a/gopls/internal/test/integration/bench/repo_test.go
+++ b/gopls/internal/test/integration/bench/repo_test.go
@@ -147,7 +147,7 @@
 // reusableDir return a reusable directory for benchmarking, or "".
 //
 // If the user specifies a directory, the test will create and populate it
-// on the first run an re-use it on subsequent runs. Otherwise it will
+// on the first run and re-use it on subsequent runs. Otherwise it will
 // create, populate, and delete a temporary directory.
 func (r *repo) reusableDir() string {
 	if r.inDir == nil {
diff --git a/gopls/internal/vulncheck/vulntest/report.go b/gopls/internal/vulncheck/vulntest/report.go
index 7dbebca..6aa8722 100644
--- a/gopls/internal/vulncheck/vulntest/report.go
+++ b/gopls/internal/vulncheck/vulntest/report.go
@@ -104,7 +104,7 @@
 	DerivedSymbols []string `yaml:"derived_symbols,omitempty"`
 }
 
-// Version is an SemVer 2.0.0 semantic version with no leading "v" prefix,
+// Version is a SemVer 2.0.0 semantic version with no leading "v" prefix,
 // as used by OSV.
 type Version string
 
diff --git a/internal/event/export/metric/info.go b/internal/event/export/metric/info.go
index a178343..5662fbe 100644
--- a/internal/event/export/metric/info.go
+++ b/internal/event/export/metric/info.go
@@ -31,7 +31,7 @@
 	Buckets []int64
 }
 
-// HistogramFloat64 represents the construction information for an float64 histogram metric.
+// HistogramFloat64 represents the construction information for a float64 histogram metric.
 type HistogramFloat64 struct {
 	// Name is the unique name of this metric.
 	Name string
diff --git a/internal/expect/extract.go b/internal/expect/extract.go
index db6b66a..1fb4349 100644
--- a/internal/expect/extract.go
+++ b/internal/expect/extract.go
@@ -21,7 +21,7 @@
 const commentStart = "@"
 const commentStartLen = len(commentStart)
 
-// Identifier is the type for an identifier in an Note argument list.
+// Identifier is the type for an identifier in a Note argument list.
 type Identifier string
 
 // Parse collects all the notes present in a file.
diff --git a/internal/gocommand/invoke.go b/internal/gocommand/invoke.go
index 5db1ed6..7ea9013 100644
--- a/internal/gocommand/invoke.go
+++ b/internal/gocommand/invoke.go
@@ -28,7 +28,7 @@
 	"golang.org/x/tools/internal/event/label"
 )
 
-// An Runner will run go command invocations and serialize
+// A Runner will run go command invocations and serialize
 // them if it sees a concurrency error.
 type Runner struct {
 	// once guards the runner initialization.
diff --git a/internal/jsonrpc2/messages.go b/internal/jsonrpc2/messages.go
index 721168f..e87d772 100644
--- a/internal/jsonrpc2/messages.go
+++ b/internal/jsonrpc2/messages.go
@@ -27,7 +27,7 @@
 	Message
 	// Method is a string containing the method name to invoke.
 	Method() string
-	// Params is an JSON value (object, array, null, or "") with the parameters of the method.
+	// Params is a JSON value (object, array, null, or "") with the parameters of the method.
 	Params() json.RawMessage
 	// isJSONRPC2Request is used to make the set of request implementations closed.
 	isJSONRPC2Request()
diff --git a/internal/jsonrpc2/serve.go b/internal/jsonrpc2/serve.go
index cfbcbcb..76df52c 100644
--- a/internal/jsonrpc2/serve.go
+++ b/internal/jsonrpc2/serve.go
@@ -46,7 +46,7 @@
 	})
 }
 
-// ListenAndServe starts an jsonrpc2 server on the given address.  If
+// ListenAndServe starts a jsonrpc2 server on the given address.  If
 // idleTimeout is non-zero, ListenAndServe exits after there are no clients for
 // this duration, otherwise it exits only on error.
 func ListenAndServe(ctx context.Context, network, addr string, server StreamServer, idleTimeout time.Duration) error {
diff --git a/internal/packagestest/expect.go b/internal/packagestest/expect.go
index 053d8e8..e3e3509 100644
--- a/internal/packagestest/expect.go
+++ b/internal/packagestest/expect.go
@@ -411,7 +411,7 @@
 			eof := tokFile.Pos(tokFile.Size())
 			return newRange(tokFile, eof, eof), args, nil
 		default:
-			// look up an marker by name
+			// look up a marker by name
 			mark, ok := e.markers[string(arg)]
 			if !ok {
 				return Range{}, nil, fmt.Errorf("cannot find marker %v", arg)
diff --git a/internal/typesinternal/errorcode.go b/internal/typesinternal/errorcode.go
index 131caab..235a6de 100644
--- a/internal/typesinternal/errorcode.go
+++ b/internal/typesinternal/errorcode.go
@@ -966,7 +966,7 @@
 	//  var _ = string(x)
 	InvalidConversion
 
-	// InvalidUntypedConversion occurs when an there is no valid implicit
+	// InvalidUntypedConversion occurs when there is no valid implicit
 	// conversion from an untyped value satisfying the type constraints of the
 	// context in which it is used.
 	//
diff --git a/playground/socket/socket.go b/playground/socket/socket.go
index 797dcc6..9e5b4a9 100644
--- a/playground/socket/socket.go
+++ b/playground/socket/socket.go
@@ -5,7 +5,7 @@
 //go:build !appengine
 // +build !appengine
 
-// Package socket implements an WebSocket-based playground backend.
+// Package socket implements a WebSocket-based playground backend.
 // Clients connect to a websocket handler and send run/kill commands, and
 // the server sends the output and exit status of the running processes.
 // Multiple clients running multiple processes may be served concurrently.