From d5f7da79870800ac2f7c2a68501f73a83d481d16 Mon Sep 17 00:00:00 2001
From: Oleksandr Redko <oleksandr.red+github@gmail.com>
Date: Mon, 19 Aug 2024 00:07:37 +0300
Subject: [PATCH] all: remove duplicated words in comments

Change-Id: Id991ec0826a4e2857f00330b4b7ff2b71907b789
Reviewed-on: https://go-review.googlesource.com/c/go/+/606615
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
---
 src/bytes/bytes_test.go                               | 2 +-
 src/cmd/compile/internal/devirtualize/devirtualize.go | 2 +-
 src/cmd/compile/internal/devirtualize/pgo.go          | 2 +-
 src/cmd/compile/internal/ir/reassignment.go           | 2 +-
 src/cmd/compile/internal/liveness/intervals.go        | 2 +-
 src/cmd/compile/internal/liveness/mergelocals.go      | 2 +-
 src/cmd/compile/internal/ssa/prove.go                 | 2 +-
 src/cmd/compile/internal/types2/signature.go          | 2 +-
 src/cmd/compile/internal/types2/typeset.go            | 2 +-
 src/cmd/go/internal/modcmd/download.go                | 2 +-
 src/cmd/go/internal/modload/buildlist.go              | 4 ++--
 src/cmd/go/internal/modload/edit.go                   | 2 +-
 src/cmd/internal/objabi/reloctype.go                  | 2 +-
 src/cmd/internal/testdir/testdir_test.go              | 2 +-
 src/cmd/link/internal/ld/lib.go                       | 2 +-
 src/go/token/position.go                              | 2 +-
 src/go/types/signature.go                             | 2 +-
 src/go/types/typeset.go                               | 2 +-
 src/internal/trace/internal/oldtrace/parser.go        | 2 +-
 src/internal/trace/traceviewer/emitter.go             | 2 +-
 src/strings/strings_test.go                           | 2 +-
 src/syscall/syscall_wasip1.go                         | 4 ++--
 22 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/bytes/bytes_test.go b/src/bytes/bytes_test.go
index da16882e82a..ead581718ac 100644
--- a/src/bytes/bytes_test.go
+++ b/src/bytes/bytes_test.go
@@ -489,7 +489,7 @@ func TestIndexRune(t *testing.T) {
 		{"a☺b☻c☹d\xe2\x98�\xff�\xed\xa0\x80", 0xD800, -1}, // Surrogate pair
 		{"a☺b☻c☹d\xe2\x98�\xff�\xed\xa0\x80", utf8.MaxRune + 1, -1},
 
-		// Test the cutover to to bytealg.Index when it is triggered in
+		// Test the cutover to bytealg.Index when it is triggered in
 		// the middle of rune that contains consecutive runs of equal bytes.
 		{"aaaaaKKKK\U000bc104", '\U000bc104', 17}, // cutover: (n + 16) / 8
 		{"aaaaaKKKK鄄", '鄄', 17},
diff --git a/src/cmd/compile/internal/devirtualize/devirtualize.go b/src/cmd/compile/internal/devirtualize/devirtualize.go
index 5d1b9526271..372d0580940 100644
--- a/src/cmd/compile/internal/devirtualize/devirtualize.go
+++ b/src/cmd/compile/internal/devirtualize/devirtualize.go
@@ -63,7 +63,7 @@ func StaticCall(call *ir.CallExpr) {
 	// dictionary parameter. We could devirtualize this call if we
 	// could derive an appropriate dictionary argument.
 	//
-	// TODO(mdempsky): If typ has has a promoted non-generic method,
+	// TODO(mdempsky): If typ has a promoted non-generic method,
 	// then that method won't require a dictionary argument. We could
 	// still devirtualize those calls.
 	//
diff --git a/src/cmd/compile/internal/devirtualize/pgo.go b/src/cmd/compile/internal/devirtualize/pgo.go
index 783940cbc20..01677d82b68 100644
--- a/src/cmd/compile/internal/devirtualize/pgo.go
+++ b/src/cmd/compile/internal/devirtualize/pgo.go
@@ -242,7 +242,7 @@ func maybeDevirtualizeFunctionCall(p *pgoir.Profile, fn *ir.Func, call *ir.CallE
 	}
 	// runtime.memhash_varlen does not look like a closure, but it uses
 	// runtime.getclosureptr to access data encoded by callers, which are
-	// are generated by cmd/compile/internal/reflectdata.genhash.
+	// generated by cmd/compile/internal/reflectdata.genhash.
 	if callee.Sym().Pkg.Path == "runtime" && callee.Sym().Name == "memhash_varlen" {
 		if base.Debug.PGODebug >= 3 {
 			fmt.Printf("callee %s is a closure (runtime.memhash_varlen), skipping\n", ir.FuncName(callee))
diff --git a/src/cmd/compile/internal/ir/reassignment.go b/src/cmd/compile/internal/ir/reassignment.go
index 9974292471a..ff54f708c22 100644
--- a/src/cmd/compile/internal/ir/reassignment.go
+++ b/src/cmd/compile/internal/ir/reassignment.go
@@ -18,7 +18,7 @@ import (
 // opposed to a new walk on every call).
 type ReassignOracle struct {
 	fn *Func
-	// maps candidate name to its defining assignment (or for
+	// maps candidate name to its defining assignment (or
 	// for params, defining func).
 	singleDef map[*Name]Node
 }
diff --git a/src/cmd/compile/internal/liveness/intervals.go b/src/cmd/compile/internal/liveness/intervals.go
index 4757cca3ce9..feca35b306d 100644
--- a/src/cmd/compile/internal/liveness/intervals.go
+++ b/src/cmd/compile/internal/liveness/intervals.go
@@ -168,7 +168,7 @@ func (c *IntervalsBuilder) Live(pos int) error {
 }
 
 // Kill method should be invoked on instruction at position p if instr
-// should be treated as as having a kill (lifetime end) for the
+// should be treated as having a kill (lifetime end) for the
 // resource. See the example in the comment at the beginning of this
 // file for an example. Note that if we see a kill at position K for a
 // resource currently live since J, this will result in a lifetime
diff --git a/src/cmd/compile/internal/liveness/mergelocals.go b/src/cmd/compile/internal/liveness/mergelocals.go
index 017c4d1dbbb..f33ebd0d81e 100644
--- a/src/cmd/compile/internal/liveness/mergelocals.go
+++ b/src/cmd/compile/internal/liveness/mergelocals.go
@@ -682,7 +682,7 @@ func nextRegion(cands []*ir.Name, idx int) int {
 // given subrange of cands described by st and en (indices into our
 // candidate var list), where the variables within this range have
 // already been determined to be compatible with respect to type,
-// size, etc. Overlapping is done in a a greedy fashion: we select the
+// size, etc. Overlapping is done in a greedy fashion: we select the
 // first element in the st->en range, then walk the rest of the
 // elements adding in vars whose lifetimes don't overlap with the
 // first element, then repeat the process until we run out of work.
diff --git a/src/cmd/compile/internal/ssa/prove.go b/src/cmd/compile/internal/ssa/prove.go
index 8acd38aa69f..87d83ba7628 100644
--- a/src/cmd/compile/internal/ssa/prove.go
+++ b/src/cmd/compile/internal/ssa/prove.go
@@ -618,7 +618,7 @@ func (ft *factsTable) newLimit(v *Value, newLim limit) bool {
 	// extract relation between its args. For example, if
 	// We learn v is false, and v is defined as a<b, then we learn a>=b.
 	if v.Type.IsBoolean() {
-		// If we reach here, is is because we have a more restrictive
+		// If we reach here, it is because we have a more restrictive
 		// value for v than the default. The only two such values
 		// are constant true or constant false.
 		if lim.min != lim.max {
diff --git a/src/cmd/compile/internal/types2/signature.go b/src/cmd/compile/internal/types2/signature.go
index 8754f5492ce..71d6032c07d 100644
--- a/src/cmd/compile/internal/types2/signature.go
+++ b/src/cmd/compile/internal/types2/signature.go
@@ -134,7 +134,7 @@ func (check *Checker) funcType(sig *Signature, recvPar *syntax.Field, tparams []
 }
 
 // collectRecv extracts the method receiver and its type parameters (if any) from rparam.
-// It declares the type parameters (but not the receiver) in the the current scope, and
+// It declares the type parameters (but not the receiver) in the current scope, and
 // returns the receiver variable and its type parameter list (if any).
 func (check *Checker) collectRecv(rparam *syntax.Field, scopePos syntax.Pos) (recv *Var, recvTParamsList *TypeParamList) {
 	// Unpack the receiver parameter which is of the form
diff --git a/src/cmd/compile/internal/types2/typeset.go b/src/cmd/compile/internal/types2/typeset.go
index 9ea0a3e8f9e..2577631a535 100644
--- a/src/cmd/compile/internal/types2/typeset.go
+++ b/src/cmd/compile/internal/types2/typeset.go
@@ -163,7 +163,7 @@ func computeInterfaceTypeSet(check *Checker, pos syntax.Pos, ityp *Interface) *_
 	// let any follow-on errors play out.
 	//
 	// TODO(gri) Consider recording when this happens and reporting
-	// it as an error (but only if there were no other errors so to
+	// it as an error (but only if there were no other errors so
 	// to not have unnecessary follow-on errors).
 	if !ityp.complete {
 		return &topTypeSet
diff --git a/src/cmd/go/internal/modcmd/download.go b/src/cmd/go/internal/modcmd/download.go
index 373accef067..2f4feae8f25 100644
--- a/src/cmd/go/internal/modcmd/download.go
+++ b/src/cmd/go/internal/modcmd/download.go
@@ -187,7 +187,7 @@ func runDownload(ctx context.Context, cmd *base.Command, args []string) {
 	infos, infosErr := modload.ListModules(ctx, args, 0, *downloadReuse)
 
 	// There is a bit of a chicken-and-egg problem here: ideally we need to know
-	// which Go version to switch to to download the requested modules, but if we
+	// which Go version to switch to download the requested modules, but if we
 	// haven't downloaded the module's go.mod file yet the GoVersion field of its
 	// info struct is not yet populated.
 	//
diff --git a/src/cmd/go/internal/modload/buildlist.go b/src/cmd/go/internal/modload/buildlist.go
index e05585d7c42..9db348c0983 100644
--- a/src/cmd/go/internal/modload/buildlist.go
+++ b/src/cmd/go/internal/modload/buildlist.go
@@ -1222,7 +1222,7 @@ func updatePrunedRoots(ctx context.Context, direct map[string]bool, rs *Requirem
 				return rs, nil
 			}
 			// The root set has converged: every root going into this iteration was
-			// already at its selected version, although we have have removed other
+			// already at its selected version, although we have removed other
 			// (redundant) roots for the same path.
 			break
 		}
@@ -1281,7 +1281,7 @@ func spotCheckRoots(ctx context.Context, rs *Requirements, mods map[module.Versi
 // module in direct as a root.
 func tidyUnprunedRoots(ctx context.Context, mainModule module.Version, old *Requirements, pkgs []*loadPkg) (*Requirements, error) {
 	var (
-		// keep is a set of of modules that provide packages or are needed to
+		// keep is a set of modules that provide packages or are needed to
 		// disambiguate imports.
 		keep     []module.Version
 		keptPath = map[string]bool{}
diff --git a/src/cmd/go/internal/modload/edit.go b/src/cmd/go/internal/modload/edit.go
index 5a5b8233c38..d7fa6d0564c 100644
--- a/src/cmd/go/internal/modload/edit.go
+++ b/src/cmd/go/internal/modload/edit.go
@@ -681,7 +681,7 @@ type dqTracker struct {
 	// in the extended module graph.
 	extendedRootPruning map[module.Version]modPruning
 
-	// dqReason records whether and why each each encountered version is
+	// dqReason records whether and why each encountered version is
 	// disqualified in a pruned or unpruned context.
 	dqReason map[module.Version]perPruning[dqState]
 
diff --git a/src/cmd/internal/objabi/reloctype.go b/src/cmd/internal/objabi/reloctype.go
index b7f0124c2a6..9106b085ea7 100644
--- a/src/cmd/internal/objabi/reloctype.go
+++ b/src/cmd/internal/objabi/reloctype.go
@@ -202,7 +202,7 @@ const (
 
 	// R_POWER_TLS marks an X-form instruction such as "ADD R3,R13,R4" as completing
 	// a sequence of GOT-relative relocations to compute a TLS address. This can be
-	// used by the system linker to to rewrite the GOT-relative TLS relocation into a
+	// used by the system linker to rewrite the GOT-relative TLS relocation into a
 	// simpler thread-pointer relative relocation. See table 3.26 and 3.28 in the
 	// ppc64 elfv2 1.4 ABI on this transformation.  Likewise, the second argument
 	// (usually called RB in X-form instructions) is assumed to be R13.
diff --git a/src/cmd/internal/testdir/testdir_test.go b/src/cmd/internal/testdir/testdir_test.go
index 68fbdffb1dc..0810cef257d 100644
--- a/src/cmd/internal/testdir/testdir_test.go
+++ b/src/cmd/internal/testdir/testdir_test.go
@@ -71,7 +71,7 @@ var (
 
 // Test is the main entrypoint that runs tests in the GOROOT/test directory.
 //
-// Each .go file test case in GOROOT/test is registered as a subtest with a
+// Each .go file test case in GOROOT/test is registered as a subtest with
 // a full name like "Test/fixedbugs/bug000.go" ('/'-separated relative path).
 func Test(t *testing.T) {
 	if *target != "" {
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index d66027387b9..39361aa815d 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -1275,7 +1275,7 @@ func hostlinksetup(ctxt *Link) {
 // cleanTimeStamps resets the timestamps for the specified list of
 // existing files to the Unix epoch (1970-01-01 00:00:00 +0000 UTC).
 // We take this step in order to help preserve reproducible builds;
-// this seems to be primarily needed for external linking on on Darwin
+// this seems to be primarily needed for external linking on Darwin
 // with later versions of xcode, which (unfortunately) seem to want to
 // incorporate object file times into the final output file's build
 // ID. See issue 64947 for the unpleasant details.
diff --git a/src/go/token/position.go b/src/go/token/position.go
index 04dbca71243..4675e93703a 100644
--- a/src/go/token/position.go
+++ b/src/go/token/position.go
@@ -306,7 +306,7 @@ func (f *File) Pos(offset int) Pos {
 // Offset returns the offset for the given file position p.
 //
 // If p is before the file's start position (or if p is NoPos),
-// the result is 0; if p is past the file's end position, the
+// the result is 0; if p is past the file's end position,
 // the result is the file size (see also go.dev/issue/57490).
 //
 // The following invariant, though not true for offset values
diff --git a/src/go/types/signature.go b/src/go/types/signature.go
index ea25ef49310..d2aa03ff789 100644
--- a/src/go/types/signature.go
+++ b/src/go/types/signature.go
@@ -155,7 +155,7 @@ func (check *Checker) funcType(sig *Signature, recvPar *ast.FieldList, ftyp *ast
 }
 
 // collectRecv extracts the method receiver and its type parameters (if any) from rparam.
-// It declares the type parameters (but not the receiver) in the the current scope, and
+// It declares the type parameters (but not the receiver) in the current scope, and
 // returns the receiver variable and its type parameter list (if any).
 func (check *Checker) collectRecv(rparam *ast.Field, scopePos token.Pos) (recv *Var, recvTParamsList *TypeParamList) {
 	// Unpack the receiver parameter which is of the form
diff --git a/src/go/types/typeset.go b/src/go/types/typeset.go
index 28f0a454684..5981c8ae62b 100644
--- a/src/go/types/typeset.go
+++ b/src/go/types/typeset.go
@@ -166,7 +166,7 @@ func computeInterfaceTypeSet(check *Checker, pos token.Pos, ityp *Interface) *_T
 	// let any follow-on errors play out.
 	//
 	// TODO(gri) Consider recording when this happens and reporting
-	// it as an error (but only if there were no other errors so to
+	// it as an error (but only if there were no other errors so
 	// to not have unnecessary follow-on errors).
 	if !ityp.complete {
 		return &topTypeSet
diff --git a/src/internal/trace/internal/oldtrace/parser.go b/src/internal/trace/internal/oldtrace/parser.go
index afbf0ed50ed..af2102b5b0a 100644
--- a/src/internal/trace/internal/oldtrace/parser.go
+++ b/src/internal/trace/internal/oldtrace/parser.go
@@ -813,7 +813,7 @@ func (p *parser) readRawEvent(flags uint, ev *rawEvent) error {
 	}
 }
 
-// loadBatch loads the next batch for pid and appends its contents to to events.
+// loadBatch loads the next batch for pid and appends its contents to events.
 func (p *parser) loadBatch(pid int32, events []Event) ([]Event, error) {
 	offsets := p.batchOffsets[pid]
 	if len(offsets) == 0 {
diff --git a/src/internal/trace/traceviewer/emitter.go b/src/internal/trace/traceviewer/emitter.go
index c91c743a7bf..c74f1c2ecf5 100644
--- a/src/internal/trace/traceviewer/emitter.go
+++ b/src/internal/trace/traceviewer/emitter.go
@@ -614,7 +614,7 @@ func (e *Emitter) tsWithinRange(ts time.Duration) bool {
 	return e.rangeStart <= ts && ts <= e.rangeEnd
 }
 
-// OptionalEvent emits ev if it's within the time range of of the consumer, i.e.
+// OptionalEvent emits ev if it's within the time range of the consumer, i.e.
 // the selected trace split range.
 func (e *Emitter) OptionalEvent(ev *format.Event) {
 	e.c.ConsumeViewerEvent(ev, false)
diff --git a/src/strings/strings_test.go b/src/strings/strings_test.go
index 39f5f4e3557..80673806647 100644
--- a/src/strings/strings_test.go
+++ b/src/strings/strings_test.go
@@ -356,7 +356,7 @@ func TestIndexRune(t *testing.T) {
 		{Repeat("𡋀", 64) + "𡌀", '𡌀', 256}, // test cutover
 		{Repeat("𡋀", 64), '𡌀', -1},
 
-		// Test the cutover to to bytealg.IndexString when it is triggered in
+		// Test the cutover to bytealg.IndexString when it is triggered in
 		// the middle of rune that contains consecutive runs of equal bytes.
 		{"aaaaaKKKK\U000bc104", '\U000bc104', 17}, // cutover: (n + 16) / 8
 		{"aaaaaKKKK鄄", '鄄', 17},
diff --git a/src/syscall/syscall_wasip1.go b/src/syscall/syscall_wasip1.go
index 84c6bddc089..bcf7676123c 100644
--- a/src/syscall/syscall_wasip1.go
+++ b/src/syscall/syscall_wasip1.go
@@ -307,7 +307,7 @@ func (w WaitStatus) TrapCause() int     { return 0 }
 
 // Rusage is a placeholder to allow compilation of the [os/exec] package
 // because we need Go programs to be portable across platforms. WASI does
-// not have a mechanism to to spawn processes so there is no reason for an
+// not have a mechanism to spawn processes so there is no reason for an
 // application to take a dependency on this type.
 type Rusage struct {
 	Utime Timeval
@@ -316,7 +316,7 @@ type Rusage struct {
 
 // ProcAttr is a placeholder to allow compilation of the [os/exec] package
 // because we need Go programs to be portable across platforms. WASI does
-// not have a mechanism to to spawn processes so there is no reason for an
+// not have a mechanism to spawn processes so there is no reason for an
 // application to take a dependency on this type.
 type ProcAttr struct {
 	Dir   string
-- 
GitLab