all: fix some typos

Change-Id: I4c5169661f9f445a2d4920786a85df70797ca24a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/512835
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
diff --git a/cmd/compilebench/main.go b/cmd/compilebench/main.go
index 754acdc..6900b25 100644
--- a/cmd/compilebench/main.go
+++ b/cmd/compilebench/main.go
@@ -567,10 +567,10 @@
 	return nil
 }
 
-// genSymAbisFile runs the assembler on the target packge asm files
+// genSymAbisFile runs the assembler on the target package asm files
 // with "-gensymabis" to produce a symabis file that will feed into
 // the Go source compilation. This is fairly hacky in that if the
-// asm invocation convenion changes it will need to be updated
+// asm invocation convention changes it will need to be updated
 // (hopefully that will not be needed too frequently).
 func genSymAbisFile(pkg *Pkg, symAbisFile, incdir string) error {
 	args := []string{"-gensymabis", "-o", symAbisFile,
diff --git a/go/analysis/passes/buildssa/testdata/src/c/c.go b/go/analysis/passes/buildssa/testdata/src/c/c.go
index 387a3b0..d6ce8b8 100644
--- a/go/analysis/passes/buildssa/testdata/src/c/c.go
+++ b/go/analysis/passes/buildssa/testdata/src/c/c.go
@@ -19,6 +19,6 @@
 	m := b.G.Load()
 	f := b.Load(&b.G)
 	if f != m {
-		panic("loads of b.G are expected to be indentical")
+		panic("loads of b.G are expected to be identical")
 	}
 }
diff --git a/go/analysis/passes/errorsas/testdata/src/a/a.go b/go/analysis/passes/errorsas/testdata/src/a/a.go
index 7a9ae89..222b279 100644
--- a/go/analysis/passes/errorsas/testdata/src/a/a.go
+++ b/go/analysis/passes/errorsas/testdata/src/a/a.go
@@ -29,7 +29,7 @@
 		ei interface{}
 	)
 	errors.As(nil, &e)     // want `second argument to errors.As should not be \*error`
-	errors.As(nil, &m)     // *T where T implemements error
+	errors.As(nil, &m)     // *T where T implements error
 	errors.As(nil, &f)     // *interface
 	errors.As(nil, perr()) // want `second argument to errors.As should not be \*error`
 	errors.As(nil, ei)     //  empty interface
diff --git a/go/analysis/passes/errorsas/testdata/src/typeparams/typeparams.go b/go/analysis/passes/errorsas/testdata/src/typeparams/typeparams.go
index 4f7ae84..16a974c 100644
--- a/go/analysis/passes/errorsas/testdata/src/typeparams/typeparams.go
+++ b/go/analysis/passes/errorsas/testdata/src/typeparams/typeparams.go
@@ -26,7 +26,7 @@
 		tw twice[myError[int]]
 	)
 	errors.As(nil, &e)
-	errors.As(nil, &m)            // *T where T implemements error
+	errors.As(nil, &m)            // *T where T implements error
 	errors.As(nil, &tw.t)         // *T where T implements error
 	errors.As(nil, perr[error]()) // want `second argument to errors.As should not be \*error`
 
diff --git a/go/ssa/builder_go120_test.go b/go/ssa/builder_go120_test.go
index acdd182..2472a9d 100644
--- a/go/ssa/builder_go120_test.go
+++ b/go/ssa/builder_go120_test.go
@@ -36,7 +36,7 @@
 			// as []rune, pointers to rune arrays, rune arrays, or strings.
 			//
 			// Comments listed given the current emitted instructions [approximately].
-			// If multiple conversions are needed, these are seperated by |.
+			// If multiple conversions are needed, these are separated by |.
 			// rune was selected as it leads to string casts (byte is similar).
 			// The length 2 is not significant.
 			// Multiple array lengths may occur in a cast in practice (including 0).
diff --git a/go/ssa/subst.go b/go/ssa/subst.go
index 89c41a8..23d19ae 100644
--- a/go/ssa/subst.go
+++ b/go/ssa/subst.go
@@ -388,7 +388,7 @@
 	//    no type params to substitute
 	// (2)generic method and recv needs to be substituted.
 
-	// Recievers can be either:
+	// Receivers can be either:
 	// named
 	// pointer to named
 	// interface
diff --git a/go/ssa/util.go b/go/ssa/util.go
index 7735dd8..68cc971 100644
--- a/go/ssa/util.go
+++ b/go/ssa/util.go
@@ -304,7 +304,7 @@
 	return T
 }
 
-// A type for representating an canonized list of types.
+// A type for representing a canonized list of types.
 type typeList []types.Type
 
 func (l *typeList) identical(ts []types.Type) bool {
diff --git a/gopls/internal/lsp/analysis/stubmethods/stubmethods.go b/gopls/internal/lsp/analysis/stubmethods/stubmethods.go
index e24447d..930cb99 100644
--- a/gopls/internal/lsp/analysis/stubmethods/stubmethods.go
+++ b/gopls/internal/lsp/analysis/stubmethods/stubmethods.go
@@ -115,7 +115,7 @@
 //
 // TODO(adonovan): this function (and its following 5 helpers) tries
 // to deduce a pair of (concrete, interface) types that are related by
-// an assignment, either explictly or through a return statement or
+// an assignment, either explicitly or through a return statement or
 // function call. This is essentially what the refactor/satisfy does,
 // more generally. Refactor to share logic, after auditing 'satisfy'
 // for safety on ill-typed code.
diff --git a/gopls/internal/lsp/cache/parse.go b/gopls/internal/lsp/cache/parse.go
index 7afa5d9..42353df 100644
--- a/gopls/internal/lsp/cache/parse.go
+++ b/gopls/internal/lsp/cache/parse.go
@@ -398,7 +398,7 @@
 //
 //	}
 //
-// The resulting bool reports whether any fixing occured.
+// The resulting bool reports whether any fixing occurred.
 func fixEmptySwitch(body *ast.BlockStmt, tok *token.File, src []byte) bool {
 	// We only care about empty switch statements.
 	if len(body.List) > 0 || !body.Rbrace.IsValid() {
@@ -475,7 +475,7 @@
 //
 // TODO(rfindley): should this constitute an ast 'fix'?
 //
-// The resulting bool reports whether any fixing occured.
+// The resulting bool reports whether any fixing occurred.
 func fixPhantomSelector(sel *ast.SelectorExpr, tf *token.File, src []byte) bool {
 	if !isPhantomUnderscore(sel.Sel, tf, src) {
 		return false
@@ -525,7 +525,7 @@
 // parser is looking for the conditional expression. However, "i := 0"
 // are not valid expressions, so we get a BadExpr.
 //
-// The resulting bool reports whether any fixing occured.
+// The resulting bool reports whether any fixing occurred.
 func fixInitStmt(bad *ast.BadExpr, parent ast.Node, tok *token.File, src []byte) bool {
 	if !bad.Pos().IsValid() || !bad.End().IsValid() {
 		return false
diff --git a/gopls/internal/lsp/fake/workdir.go b/gopls/internal/lsp/fake/workdir.go
index c064b28..d5e8eb2 100644
--- a/gopls/internal/lsp/fake/workdir.go
+++ b/gopls/internal/lsp/fake/workdir.go
@@ -120,7 +120,7 @@
 // fileID identifies a file version on disk.
 type fileID struct {
 	mtime time.Time
-	hash  string // empty if mtime is old enough to be reliabe; otherwise a file digest
+	hash  string // empty if mtime is old enough to be reliable; otherwise a file digest
 }
 
 func hashFile(data []byte) string {
@@ -363,7 +363,7 @@
 			return nil
 		}
 
-		// Opt: avoid reading the file if mtime is sufficently old to be reliable.
+		// Opt: avoid reading the file if mtime is sufficiently old to be reliable.
 		//
 		// If mtime is recent, it may not sufficiently identify the file contents:
 		// a subsequent write could result in the same mtime. For these cases, we
diff --git a/gopls/internal/lsp/source/rename.go b/gopls/internal/lsp/source/rename.go
index 40810dd..02bdaed 100644
--- a/gopls/internal/lsp/source/rename.go
+++ b/gopls/internal/lsp/source/rename.go
@@ -1061,7 +1061,7 @@
 	}
 
 	// Find all identifiers in the package that define or use a
-	// renamed object. We iterate over info as it is more efficent
+	// renamed object. We iterate over info as it is more efficient
 	// than calling ast.Inspect for each of r.pkg.CompiledGoFiles().
 	type item struct {
 		node  ast.Node // Ident, ImportSpec (obj=PkgName), or CaseClause (obj=Var)
diff --git a/gopls/internal/regtest/bench/repo_test.go b/gopls/internal/regtest/bench/repo_test.go
index 18c6edf..c3b8b3b 100644
--- a/gopls/internal/regtest/bench/repo_test.go
+++ b/gopls/internal/regtest/bench/repo_test.go
@@ -115,7 +115,7 @@
 		tb.Fatalf("repo %s does not exist", name)
 	}
 	if !repo.short && testing.Short() {
-		tb.Skipf("large repo %s does not run whith -short", repo.name)
+		tb.Skipf("large repo %s does not run with -short", repo.name)
 	}
 	return repo
 }
diff --git a/internal/persistent/map.go b/internal/persistent/map.go
index a5d3083..a9d878f 100644
--- a/internal/persistent/map.go
+++ b/internal/persistent/map.go
@@ -18,7 +18,7 @@
 // * Each value is reference counted by nodes which hold it.
 // * Each node is reference counted by its parent nodes.
 // * Each map is considered a top-level parent node from reference counting perspective.
-// * Each change does always effectivelly produce a new top level node.
+// * Each change does always effectively produce a new top level node.
 //
 // Functions which operate directly with nodes do have a notation in form of
 // `foo(arg1:+n1, arg2:+n2) (ret1:+n3)`.