[release-branch.go1.21] all: merge master (b88bd91) into release-branch.go1.21

Merge List:

+ 2023-07-13 b88bd917b8 cmd/go/internal/modfetch: always allow Stat for the current toolchain to succeed
+ 2023-07-13 d4f0d896a6 net/http: revert stray edit to h2_bundle.go from CL 508996
+ 2023-07-13 4a0f51696e all: remove duplicate word and fix comment
+ 2023-07-12 49d42128fd all: fix typos and remove repeated words

Change-Id: Ie4f17f633483d5cd1d244b6e7cde6422dc246d9e
diff --git a/src/cmd/go/internal/modfetch/toolchain.go b/src/cmd/go/internal/modfetch/toolchain.go
index 1669ab9..0d7cfcf 100644
--- a/src/cmd/go/internal/modfetch/toolchain.go
+++ b/src/cmd/go/internal/modfetch/toolchain.go
@@ -98,13 +98,23 @@
 	if !gover.IsValid(v) {
 		return nil, fmt.Errorf("invalid %s version %s", r.path, rev)
 	}
+
 	// If we're asking about "go" (not "toolchain"), pretend to have
 	// all earlier Go versions available without network access:
 	// we will provide those ourselves, at least in GOTOOLCHAIN=auto mode.
 	if r.path == "go" && gover.Compare(v, gover.Local()) <= 0 {
 		return &RevInfo{Version: prefix + v}, nil
 	}
+
+	// Similarly, if we're asking about *exactly* the current toolchain,
+	// we don't need to access the network to know that it exists.
+	if r.path == "toolchain" && v == gover.Local() {
+		return &RevInfo{Version: prefix + v}, nil
+	}
+
 	if gover.IsLang(v) {
+		// We can only use a language (development) version if the current toolchain
+		// implements that version, and the two checks above have ruled that out.
 		return nil, fmt.Errorf("go language version %s is not a toolchain version", rev)
 	}
 
diff --git a/src/cmd/link/internal/loadpe/ldpe.go b/src/cmd/link/internal/loadpe/ldpe.go
index 0a610ff0..81c2841 100644
--- a/src/cmd/link/internal/loadpe/ldpe.go
+++ b/src/cmd/link/internal/loadpe/ldpe.go
@@ -222,7 +222,7 @@
 var comdatDefinitions = make(map[string]int64)
 
 // Load loads the PE file pn from input.
-// Symbols from the object file are created via the loader 'l', and
+// Symbols from the object file are created via the loader 'l',
 // and a slice of the text symbols is returned.
 // If an .rsrc section or set of .rsrc$xx sections is found, its symbols are
 // returned as rsrc.
diff --git a/src/internal/coverage/cmerge/merge.go b/src/internal/coverage/cmerge/merge.go
index 16fa1e8..1339803 100644
--- a/src/internal/coverage/cmerge/merge.go
+++ b/src/internal/coverage/cmerge/merge.go
@@ -68,7 +68,7 @@
 	return result
 }
 
-// Saturating add does a saturing addition of 'dst' and 'src',
+// Saturating add does a saturating addition of 'dst' and 'src',
 // returning added value or math.MaxUint32 plus an overflow flag.
 func SaturatingAdd(dst, src uint32) (uint32, bool) {
 	d, s := uint64(dst), uint64(src)
diff --git a/src/internal/diff/diff.go b/src/internal/diff/diff.go
index 47b2856..0aeeb75 100644
--- a/src/internal/diff/diff.go
+++ b/src/internal/diff/diff.go
@@ -76,7 +76,7 @@
 
 		// Expand matching lines as far possible,
 		// establishing that x[start.x:end.x] == y[start.y:end.y].
-		// Note that on the first (or last) iteration we may (or definitey do)
+		// Note that on the first (or last) iteration we may (or definitely do)
 		// have an empty match: start.x==end.x and start.y==end.y.
 		start := m
 		for start.x > done.x && start.y > done.y && x[start.x-1] == y[start.y-1] {
diff --git a/src/internal/testenv/exec.go b/src/internal/testenv/exec.go
index c67ff53..50d3b0d 100644
--- a/src/internal/testenv/exec.go
+++ b/src/internal/testenv/exec.go
@@ -163,8 +163,8 @@
 			// grace periods to clean up: one for the delay between the first
 			// termination signal being sent (via the Cancel callback when the Context
 			// expires) and the process being forcibly terminated (via the WaitDelay
-			// field), and a second one for the delay becween the process being
-			// terminated and and the test logging its output for debugging.
+			// field), and a second one for the delay between the process being
+			// terminated and the test logging its output for debugging.
 			//
 			// (We want to ensure that the test process itself has enough time to
 			// log the output before it is also terminated.)
diff --git a/src/os/error.go b/src/os/error.go
index 9827446..62ede9d 100644
--- a/src/os/error.go
+++ b/src/os/error.go
@@ -31,7 +31,7 @@
 
 // errDeadlineExceeded returns the value for os.ErrDeadlineExceeded.
 // This error comes from the internal/poll package, which is also
-// used by package net. Doing this this way ensures that the net
+// used by package net. Doing it this way ensures that the net
 // package will return os.ErrDeadlineExceeded for an exceeded deadline,
 // as documented by net.Conn.SetDeadline, without requiring any extra
 // work in the net package and without requiring the internal/poll
diff --git a/src/runtime/metrics.go b/src/runtime/metrics.go
index 4cd447a..8ef1b02 100644
--- a/src/runtime/metrics.go
+++ b/src/runtime/metrics.go
@@ -660,7 +660,7 @@
 // compute populates the cpuStatsAggregate with values from the runtime.
 func (a *cpuStatsAggregate) compute() {
 	a.cpuStats = work.cpuStats
-	// TODO(mknyszek): Update the the CPU stats again so that we're not
+	// TODO(mknyszek): Update the CPU stats again so that we're not
 	// just relying on the STW snapshot. The issue here is that currently
 	// this will cause non-monotonicity in the "user" CPU time metric.
 	//
diff --git a/src/runtime/mgcscavenge.go b/src/runtime/mgcscavenge.go
index 10e93a1..82a94be 100644
--- a/src/runtime/mgcscavenge.go
+++ b/src/runtime/mgcscavenge.go
@@ -884,7 +884,7 @@
 // segment which represents a contiguous region of free and unscavenged memory.
 //
 // searchIdx indicates the page index within this chunk to start the search, but
-// note that findScavengeCandidate searches backwards through the pallocData. As a
+// note that findScavengeCandidate searches backwards through the pallocData. As
 // a result, it will return the highest scavenge candidate in address order.
 //
 // min indicates a hard minimum size and alignment for runs of pages. That is,