all: fix typos

Change-Id: I75fed8f43aa08a780adf0027d86abebf710e9716
GitHub-Last-Rev: 9e3fe5921437ca6c7dff5fa115f4ff494d649bef
GitHub-Pull-Request: golang/text#4
Reviewed-on: https://go-review.googlesource.com/c/145358
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/date/gen.go b/date/gen.go
index 6f4ae07..1fff919 100644
--- a/date/gen.go
+++ b/date/gen.go
@@ -28,7 +28,7 @@
 // - Compile format patterns.
 // - Compress the large amount of redundancy in metazones.
 // - Split trees (with shared buckets) with data that is enough for default
-//   formatting of Go Time values and and tables that are needed for larger
+//   formatting of Go Time values and tables that are needed for larger
 //   variants.
 // - zone to metaZone mappings (in supplemental)
 // - Add more enum values and also some key maps for some of the elements.
diff --git a/gen.go b/gen.go
index 3131edd..40ae925 100644
--- a/gen.go
+++ b/gen.go
@@ -268,7 +268,7 @@
 // copyPackage copies relevant files from a directory in x/text to the
 // destination package directory. The destination package is assumed to have
 // the same name. For each copied file go:generate lines are removed and
-// and package comments are rewritten to the new path.
+// package comments are rewritten to the new path.
 func copyPackage(dirSrc, dirDst, search, replace string) {
 	err := filepath.Walk(dirSrc, func(file string, info os.FileInfo, err error) error {
 		base := filepath.Base(file)
diff --git a/internal/cldrtree/cldrtree_test.go b/internal/cldrtree/cldrtree_test.go
index 15960c8..06c366a 100644
--- a/internal/cldrtree/cldrtree_test.go
+++ b/internal/cldrtree/cldrtree_test.go
@@ -74,7 +74,7 @@
 	tree1, _ := loadTestdata(t, "test1")
 	tree2, _ := loadTestdata(t, "test2")
 
-	// Constants for second test test
+	// Constants for second test
 	const (
 		calendar = iota
 		field
diff --git a/internal/colltab/numeric.go b/internal/colltab/numeric.go
index 38c255c..53b819c 100644
--- a/internal/colltab/numeric.go
+++ b/internal/colltab/numeric.go
@@ -130,7 +130,7 @@
 // init completes initialization of a numberConverter and prepares it for adding
 // more digits. elems is assumed to have a digit starting at oldLen.
 func (nc *numberConverter) init(elems []Elem, oldLen int, isZero bool) {
-	// Insert a marker indicating the start of a number and and a placeholder
+	// Insert a marker indicating the start of a number and a placeholder
 	// for the number of digits.
 	if isZero {
 		elems = append(elems[:oldLen], nc.w.numberStart, 0)
diff --git a/internal/gen/code.go b/internal/gen/code.go
index 25aaa03..8622c7f 100644
--- a/internal/gen/code.go
+++ b/internal/gen/code.go
@@ -48,7 +48,7 @@
 }
 
 // WriteGoFile appends the buffer with the total size of all created structures
-// and writes it as a Go file to the the given file with the given package name.
+// and writes it as a Go file to the given file with the given package name.
 func (w *CodeWriter) WriteGoFile(filename, pkg string) {
 	f, err := os.Create(filename)
 	if err != nil {
@@ -61,7 +61,7 @@
 }
 
 // WriteVersionedGoFile appends the buffer with the total size of all created
-// structures and writes it as a Go file to the the given file with the given
+// structures and writes it as a Go file to the given file with the given
 // package name and build tags for the current Unicode version,
 func (w *CodeWriter) WriteVersionedGoFile(filename, pkg string) {
 	tags := buildTags()
@@ -79,7 +79,7 @@
 }
 
 // WriteGo appends the buffer with the total size of all created structures and
-// writes it as a Go file to the the given writer with the given package name.
+// writes it as a Go file to the given writer with the given package name.
 func (w *CodeWriter) WriteGo(out io.Writer, pkg, tags string) (n int, err error) {
 	sz := w.Size
 	w.WriteComment("Total table size %d bytes (%dKiB); checksum: %X\n", sz, sz/1024, w.Hash.Sum32())
diff --git a/internal/triegen/triegen.go b/internal/triegen/triegen.go
index adb0108..51d218a 100644
--- a/internal/triegen/triegen.go
+++ b/internal/triegen/triegen.go
@@ -53,7 +53,7 @@
 //		Indexes of starter blocks in case of multiple trie roots.
 //
 // It is recommended that users test the generated trie by checking the returned
-// value for every rune. Such exhaustive tests are possible as the the number of
+// value for every rune. Such exhaustive tests are possible as the number of
 // runes in Unicode is limited.
 package triegen // import "golang.org/x/text/internal/triegen"
 
diff --git a/internal/ucd/ucd_test.go b/internal/ucd/ucd_test.go
index 11a6542..70ca541 100644
--- a/internal/ucd/ucd_test.go
+++ b/internal/ucd/ucd_test.go
@@ -22,7 +22,7 @@
 D;        ;13;-5;1.75;
 
 @Part1   # Another part. 
-# We test part comments get removed by not commenting the the next line.
+# We test part comments get removed by not commenting the next line.
 E..10FFFF; F;   14  ; -6;   2.75;
 `
 
diff --git a/language/coverage.go b/language/coverage.go
index fdb6156..a24fd1a 100644
--- a/language/coverage.go
+++ b/language/coverage.go
@@ -80,7 +80,7 @@
 	return nil
 }
 
-// coverage is used used by NewCoverage which is used as a convenient way for
+// coverage is used by NewCoverage which is used as a convenient way for
 // creating Coverage implementations for partially defined data. Very often a
 // package will only need to define a subset of slices. coverage provides a
 // convenient way to do this. Moreover, packages using NewCoverage, instead of
diff --git a/language/display/display.go b/language/display/display.go
index eafe54a..d043da9 100644
--- a/language/display/display.go
+++ b/language/display/display.go
@@ -62,7 +62,7 @@
 }
 
 // Language returns a Formatter that renders the name for lang in the
-// the current language. x may be a language.Base or a language.Tag.
+// current language. x may be a language.Base or a language.Tag.
 // It renders lang in the default language if no translation for the current
 // language is supported.
 func Language(lang interface{}) Formatter {
diff --git a/language/parse.go b/language/parse.go
index 3f7ae4d..11acfd8 100644
--- a/language/parse.go
+++ b/language/parse.go
@@ -41,7 +41,7 @@
 // value. All other values are preserved. It accepts tags in the BCP 47 format
 // and extensions to this standard defined in
 // https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers.
-// The resulting tag is canonicalized using the the canonicalization type c.
+// The resulting tag is canonicalized using the canonicalization type c.
 func (c CanonType) Parse(s string) (t Tag, err error) {
 	tt, err := language.Parse(s)
 	if err != nil {
@@ -199,7 +199,7 @@
 	return strings.TrimSpace(s), ""
 }
 
-// Add hack mapping to deal with a small number of cases that that occur
+// Add hack mapping to deal with a small number of cases that occur
 // in Accept-Language (with reasonable frequency).
 var acceptFallback = map[string]language.Language{
 	"english": _en,
diff --git a/transform/transform.go b/transform/transform.go
index fe47b9b..919e3d9 100644
--- a/transform/transform.go
+++ b/transform/transform.go
@@ -78,8 +78,8 @@
 	// considering the error err.
 	//
 	// A nil error means that all input bytes are known to be identical to the
-	// output produced by the Transformer. A nil error can be be returned
-	// regardless of whether atEOF is true. If err is nil, then then n must
+	// output produced by the Transformer. A nil error can be returned
+	// regardless of whether atEOF is true. If err is nil, then n must
 	// equal len(src); the converse is not necessarily true.
 	//
 	// ErrEndOfSpan means that the Transformer output may differ from the
diff --git a/unicode/bidi/bracket.go b/unicode/bidi/bracket.go
index 3fef316..1853939 100644
--- a/unicode/bidi/bracket.go
+++ b/unicode/bidi/bracket.go
@@ -246,7 +246,7 @@
 // assuming the given embedding direction.
 //
 // It returns ON if no strong type is found. If a single strong type is found,
-// it returns this this type. Otherwise it returns the embedding direction.
+// it returns this type. Otherwise it returns the embedding direction.
 //
 // TODO: use separate type for "strong" directionality.
 func (p *bracketPairer) classifyPairContent(loc bracketPair, dirEmbed Class) Class {
diff --git a/unicode/cldr/makexml.go b/unicode/cldr/makexml.go
index 6114d01..eb26306 100644
--- a/unicode/cldr/makexml.go
+++ b/unicode/cldr/makexml.go
@@ -153,7 +153,7 @@
 // Dates contains information regarding the format and parsing of dates and times.
 `,
 	"localeDisplayNames": `
-// LocaleDisplayNames specifies localized display names for for scripts, languages,
+// LocaleDisplayNames specifies localized display names for scripts, languages,
 // countries, currencies, and variants.
 `,
 	"numbers": `
diff --git a/unicode/cldr/resolve.go b/unicode/cldr/resolve.go
index d9a1ff3..31cc7be 100644
--- a/unicode/cldr/resolve.go
+++ b/unicode/cldr/resolve.go
@@ -309,7 +309,7 @@
 }
 
 // attrKey computes a key based on the distinguishable attributes of
-// an element and it's values.
+// an element and its values.
 func attrKey(v reflect.Value, exclude ...string) string {
 	parts := []string{}
 	ename := v.Interface().(Elem).GetCommon().name
diff --git a/unicode/cldr/xml.go b/unicode/cldr/xml.go
index f847663..bbae53b 100644
--- a/unicode/cldr/xml.go
+++ b/unicode/cldr/xml.go
@@ -1237,7 +1237,7 @@
 	} `xml:"metazone"`
 }
 
-// LocaleDisplayNames specifies localized display names for for scripts, languages,
+// LocaleDisplayNames specifies localized display names for scripts, languages,
 // countries, currencies, and variants.
 type LocaleDisplayNames struct {
 	Common
diff --git a/unicode/norm/normalize_test.go b/unicode/norm/normalize_test.go
index 0e56d45..c5b322a 100644
--- a/unicode/norm/normalize_test.go
+++ b/unicode/norm/normalize_test.go
@@ -437,7 +437,7 @@
 	{"abc\u00C0", true, 5, nil},
 	// correctly ordered combining characters
 	// TODO: b may combine with modifiers, which is why this fails. We could
-	// make a more precise test that that actually checks whether last
+	// make a more precise test that actually checks whether last
 	// characters combines. Probably not worth it.
 	{"ab\u0300", true, 1, transform.ErrEndOfSpan},
 	{"ab\u0300cd", true, 1, transform.ErrEndOfSpan},
diff --git a/unicode/norm/readwriter.go b/unicode/norm/readwriter.go
index d926ee9..b38096f 100644
--- a/unicode/norm/readwriter.go
+++ b/unicode/norm/readwriter.go
@@ -60,8 +60,8 @@
 }
 
 // Writer returns a new writer that implements Write(b)
-// by writing f(b) to w.  The returned writer may use an
-// an internal buffer to maintain state across Write calls.
+// by writing f(b) to w. The returned writer may use an
+// internal buffer to maintain state across Write calls.
 // Calling its Close method writes any buffered data to w.
 func (f Form) Writer(w io.Writer) io.WriteCloser {
 	wr := &normWriter{rb: reorderBuffer{}, w: w}
diff --git a/width/tables_test.go b/width/tables_test.go
index 189febd..706c171 100644
--- a/width/tables_test.go
+++ b/width/tables_test.go
@@ -45,7 +45,7 @@
 	}
 }
 
-// TestAmbiguous verifies that that ambiguous runes with a mapping always map to
+// TestAmbiguous verifies that ambiguous runes with a mapping always map to
 // a halfwidth rune.
 func TestAmbiguous(t *testing.T) {
 	for r, m := range mapRunes {