all: fix more typos

Change-Id: I978ad5e1800ebfceb78aaced438331a8341715d4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194697
Reviewed-by: Toshihiro Shiino <shiino.toshihiro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/go/analysis/analysistest/analysistest.go b/go/analysis/analysistest/analysistest.go
index 5ecb553..0d323dc 100644
--- a/go/analysis/analysistest/analysistest.go
+++ b/go/analysis/analysistest/analysistest.go
@@ -329,7 +329,7 @@
 }
 
 // parseExpectations parses the content of a "// want ..." comment
-// and returns the expections, a mixture of diagnostics ("rx") and
+// and returns the expectations, a mixture of diagnostics ("rx") and
 // facts (name:"rx").
 func parseExpectations(text string) ([]expectation, error) {
 	var scanErr string
diff --git a/go/analysis/analysistest/analysistest_test.go b/go/analysis/analysistest/analysistest_test.go
index 9d0e2b9..2b08542 100644
--- a/go/analysis/analysistest/analysistest_test.go
+++ b/go/analysis/analysistest/analysistest_test.go
@@ -42,7 +42,7 @@
 	print() // want foo:
 	print() // want "\xZZ scan error"
 
-	// A dignostic is reported at this line, but the expectation doesn't match:
+	// A diagnostic is reported at this line, but the expectation doesn't match:
 	println("hello, world") // want "wrong expectation text"
 
 	// An unexpected diagnostic is reported at this line:
diff --git a/go/analysis/doc/suggested_fixes.md b/go/analysis/doc/suggested_fixes.md
index b43e99c..f46871a 100644
--- a/go/analysis/doc/suggested_fixes.md
+++ b/go/analysis/doc/suggested_fixes.md
@@ -110,7 +110,7 @@
 
 ### Performing transformations directly on the AST
 
-Even though it may be more convienient
+Even though it may be more convenient
 for authors of refactorings to perform transformations directly on
 the AST, allowing mutations on the AST would mean that a copy of the AST
 would need to be made every time a transformation was produced, to avoid
diff --git a/go/analysis/internal/analysisflags/flags.go b/go/analysis/internal/analysisflags/flags.go
index 14274ea..0778f42 100644
--- a/go/analysis/internal/analysisflags/flags.go
+++ b/go/analysis/internal/analysisflags/flags.go
@@ -209,7 +209,7 @@
 		log.Fatalf("unsupported flag value: -V=%s", s)
 	}
 
-	// This replicates the miminal subset of
+	// This replicates the minimal subset of
 	// cmd/internal/objabi.AddVersionFlag, which is private to the
 	// go tool yet forms part of our command-line interface.
 	// TODO(adonovan): clarify the contract.
diff --git a/go/analysis/internal/checker/checker.go b/go/analysis/internal/checker/checker.go
index 4a29a96..8802e9a 100644
--- a/go/analysis/internal/checker/checker.go
+++ b/go/analysis/internal/checker/checker.go
@@ -457,7 +457,7 @@
 		visitAll(roots)
 
 		if exitcode == 0 && len(seen) > 0 {
-			exitcode = 3 // successfuly produced diagnostics
+			exitcode = 3 // successfully produced diagnostics
 		}
 	}
 
diff --git a/go/analysis/internal/checker/checker_test.go b/go/analysis/internal/checker/checker_test.go
index 152a997..d827278 100644
--- a/go/analysis/internal/checker/checker_test.go
+++ b/go/analysis/internal/checker/checker_test.go
@@ -58,7 +58,7 @@
 
 	got := string(contents)
 	if got != want {
-		t.Errorf("contents of rewrtitten file\ngot: %s\nwant: %s", got, want)
+		t.Errorf("contents of rewritten file\ngot: %s\nwant: %s", got, want)
 	}
 
 	defer cleanup()
diff --git a/go/analysis/passes/printf/types.go b/go/analysis/passes/printf/types.go
index 5000d9a..bd8a594 100644
--- a/go/analysis/passes/printf/types.go
+++ b/go/analysis/passes/printf/types.go
@@ -234,7 +234,7 @@
 			return false
 		}
 		if t&argString != 0 && !typf.Exported() && isConvertibleToString(pass, typf.Type()) {
-			// Issue #17798: unexported Stringer or error cannot be properly fomatted.
+			// Issue #17798: unexported Stringer or error cannot be properly formatted.
 			return false
 		}
 	}
diff --git a/go/buildutil/overlay.go b/go/buildutil/overlay.go
index 3f71c4f..8e23908 100644
--- a/go/buildutil/overlay.go
+++ b/go/buildutil/overlay.go
@@ -65,7 +65,7 @@
 //
 // The archive consists of a series of files. Each file consists of a
 // name, a decimal file size and the file contents, separated by
-// newlinews. No newline follows after the file contents.
+// newlines. No newline follows after the file contents.
 func ParseOverlayArchive(archive io.Reader) (map[string][]byte, error) {
 	overlay := make(map[string][]byte)
 	r := bufio.NewReader(archive)
diff --git a/go/internal/gcimporter/bexport_test.go b/go/internal/gcimporter/bexport_test.go
index 89870b1..de7b921 100644
--- a/go/internal/gcimporter/bexport_test.go
+++ b/go/internal/gcimporter/bexport_test.go
@@ -245,7 +245,7 @@
 			return fmt.Errorf("results: %s", err)
 		}
 		if x.Variadic() != y.Variadic() {
-			return fmt.Errorf("unequal varidicity: %t vs %t",
+			return fmt.Errorf("unequal variadicity: %t vs %t",
 				x.Variadic(), y.Variadic())
 		}
 		if (x.Recv() != nil) != (y.Recv() != nil) {
diff --git a/go/packages/golist.go b/go/packages/golist.go
index 4a36286..88e0cbc 100644
--- a/go/packages/golist.go
+++ b/go/packages/golist.go
@@ -678,7 +678,7 @@
 		// go list -e, when given an absolute path, will find the package contained at
 		// that directory. But when no package exists there, it will return a fake package
 		// with an error and the ImportPath set to the absolute path provided to go list.
-		// Try toto convert that absolute path to what its package path would be if it's
+		// Try to convert that absolute path to what its package path would be if it's
 		// contained in a known module or GOPATH entry. This will allow the package to be
 		// properly "reclaimed" when overlays are processed.
 		if filepath.IsAbs(p.ImportPath) && p.Error != nil {
diff --git a/go/packages/packages_test.go b/go/packages/packages_test.go
index 7b79dc1..1f73688 100644
--- a/go/packages/packages_test.go
+++ b/go/packages/packages_test.go
@@ -2158,7 +2158,7 @@
 		t.Fatalf("Imports of loaded package: want [fmt], got %v", pkg.Imports)
 	}
 	if len(pkg.GoFiles) != 1 || pkg.GoFiles[0] != filename {
-		t.Fatalf("GoFiles of loaded packge: want [%s], got %v", filename, pkg.GoFiles)
+		t.Fatalf("GoFiles of loaded package: want [%s], got %v", filename, pkg.GoFiles)
 	}
 }
 
diff --git a/go/packages/packagestest/expect.go b/go/packages/packagestest/expect.go
index cf4b673..ef41606 100644
--- a/go/packages/packagestest/expect.go
+++ b/go/packages/packagestest/expect.go
@@ -118,7 +118,7 @@
 	return nil
 }
 
-// Range is a type alias for span.Range for backwards compatability, prefer
+// Range is a type alias for span.Range for backwards compatibility, prefer
 // using span.Range directly.
 type Range = span.Range
 
diff --git a/go/pointer/gen.go b/go/pointer/gen.go
index a111175..f2a5171 100644
--- a/go/pointer/gen.go
+++ b/go/pointer/gen.go
@@ -512,7 +512,7 @@
 	a.addressOf(instr.Type(), a.valueNode(z), w) //  z = &w
 }
 
-// genBuiltinCall generates contraints for a call to a built-in.
+// genBuiltinCall generates constraints for a call to a built-in.
 func (a *analysis) genBuiltinCall(instr ssa.CallInstruction, cgn *cgnode) {
 	call := instr.Common()
 	switch call.Value.(*ssa.Builtin).Name() {
diff --git a/go/pointer/hvn.go b/go/pointer/hvn.go
index 48051ae..192e405 100644
--- a/go/pointer/hvn.go
+++ b/go/pointer/hvn.go
@@ -89,7 +89,7 @@
 //   their expanded-out sets are equal.
 // * HR (HVN with deReference---see paper): this will require that we
 //   apply HVN until fixed point, which may need more bookkeeping of the
-//   correspondance of main nodes to onodes.
+//   correspondence of main nodes to onodes.
 // * Location Equivalence (see paper): have points-to sets contain not
 //   locations but location-equivalence class labels, each representing
 //   a set of locations.
diff --git a/go/ssa/ssautil/load.go b/go/ssa/ssautil/load.go
index 659d19f..6d65b78 100644
--- a/go/ssa/ssautil/load.go
+++ b/go/ssa/ssautil/load.go
@@ -46,7 +46,7 @@
 //
 // AllPackages creates an SSA package for each well-typed package in the
 // initial list, plus all their dependencies. The resulting list of
-// packages corresponds to the list of intial packages, and may contain
+// packages corresponds to the list of initial packages, and may contain
 // a nil if SSA code could not be constructed for the corresponding
 // initial package due to type errors.
 //
diff --git a/go/types/objectpath/objectpath.go b/go/types/objectpath/objectpath.go
index 0d85488..882e3b3 100644
--- a/go/types/objectpath/objectpath.go
+++ b/go/types/objectpath/objectpath.go
@@ -376,7 +376,7 @@
 		return nil, fmt.Errorf("package %s does not contain %q", pkg.Path(), pkgobj)
 	}
 
-	// abtraction of *types.{Pointer,Slice,Array,Chan,Map}
+	// abstraction of *types.{Pointer,Slice,Array,Chan,Map}
 	type hasElem interface {
 		Elem() types.Type
 	}