all: fix some comments
Change-Id: Ia16a9be87ce1537f79cdf4ac11942191731f75bb
Reviewed-on: https://go-review.googlesource.com/c/exp/+/713140
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
diff --git a/apidiff/testdata/basics.go b/apidiff/testdata/basics.go
index 94c0940..2b1c0a4 100644
--- a/apidiff/testdata/basics.go
+++ b/apidiff/testdata/basics.go
@@ -48,7 +48,7 @@
var V5 u1
// new
-var V5 u2 // OK: V5 has changed type, but old u1 corresopnds to new u2
+var V5 u2 // OK: V5 has changed type, but old u1 corresponds to new u2
// Splitting a single type into two is an incompatible change.
// both
diff --git a/errors/wrap.go b/errors/wrap.go
index c936d97..fa350bc 100644
--- a/errors/wrap.go
+++ b/errors/wrap.go
@@ -58,7 +58,7 @@
if x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) {
return true
}
- // TODO: consider supporing target.Is(err). This would allow
+ // TODO: consider supporting target.Is(err). This would allow
// user-definable predicates, but also may allow for coping with sloppy
// APIs, thereby making it easier to get away with them.
if err = Unwrap(err); err == nil {
diff --git a/event/adapter/logfmt/logfmt.go b/event/adapter/logfmt/logfmt.go
index 5789e7a..162a0a1 100644
--- a/event/adapter/logfmt/logfmt.go
+++ b/event/adapter/logfmt/logfmt.go
@@ -206,7 +206,7 @@
io.WriteString(w, `"`)
}
-// time writes a timstamp in the same format as
+// time writes a timestamp in the same format as
func (p *Printer) time(w io.Writer, t time.Time) {
year, month, day := t.Date()
hour, minute, second := t.Clock()
diff --git a/rand/rand.go b/rand/rand.go
index 4da3b0d..16ecc37 100644
--- a/rand/rand.go
+++ b/rand/rand.go
@@ -349,7 +349,7 @@
s.lk.Unlock()
}
-// seedPos implements Seed for a LockedSource without a race condiiton.
+// seedPos implements Seed for a LockedSource without a race condition.
func (s *LockedSource) seedPos(seed uint64, readPos *int8) {
s.lk.Lock()
s.src.Seed(seed)
diff --git a/shiny/driver/gldriver/window.go b/shiny/driver/gldriver/window.go
index 82baf2c..97fad8e 100644
--- a/shiny/driver/gldriver/window.go
+++ b/shiny/driver/gldriver/window.go
@@ -84,7 +84,7 @@
func (w *windowImpl) Release() {
// There are two ways a window can be closed: the Operating System or
// Desktop Environment can initiate (e.g. in response to a user clicking a
- // red button), or the Go app can programatically close the window (by
+ // red button), or the Go app can programmatically close the window (by
// calling Window.Release).
//
// When the OS closes a window:
diff --git a/shiny/screen/screen.go b/shiny/screen/screen.go
index 5d89fe8..65b92d3 100644
--- a/shiny/screen/screen.go
+++ b/shiny/screen/screen.go
@@ -275,7 +275,7 @@
//
// It is valid to upload a Buffer while another upload of the same Buffer
// is in progress, but a Buffer's image.RGBA pixel contents should not be
- // accessed while it is uploading. A Buffer is re-usable, in that its pixel
+ // accessed while it is uploading. A Buffer is reusable, in that its pixel
// contents can be further modified, once all outstanding calls to Upload
// have returned.
//
diff --git a/shiny/text/text.go b/shiny/text/text.go
index f8bb5ca..4d1c9d3 100644
--- a/shiny/text/text.go
+++ b/shiny/text/text.go
@@ -32,7 +32,7 @@
//
// Either way, such modifications can cause re-layout, which can add or remove
// Paragraphs, Lines and Boxes. The underlying memory for such structs can be
-// re-used, so pointer values, such as of type *Box, should not be held over
+// reused, so pointer values, such as of type *Box, should not be held over
// such modifications.
package text // import "golang.org/x/exp/shiny/text"
@@ -613,7 +613,7 @@
//
// A Frame can have only one active lineReader at any one time. To avoid
// excessive memory allocation and garbage collection, the lineReader's data is
-// a field of the Frame struct and re-used.
+// a field of the Frame struct and reused.
type lineReader struct{ f *Frame }
func (z lineReader) bAndK() bAndK {
diff --git a/shiny/widget/flex/flex.go b/shiny/widget/flex/flex.go
index 22bd019..22cbd27 100644
--- a/shiny/widget/flex/flex.go
+++ b/shiny/widget/flex/flex.go
@@ -297,7 +297,7 @@
sumClampDiff := 0.0
for _, child := range line.child {
// TODO: we work in whole pixels but flex calculations are done in
- // fractional pixels. Take this oppertunity to clamp us to whole
+ // fractional pixels. Take this opportunity to clamp us to whole
// pixels and make sure we sum correctly.
if child.frozen {
continue
diff --git a/shiny/widget/node/node.go b/shiny/widget/node/node.go
index 89893f5..0709f49 100644
--- a/shiny/widget/node/node.go
+++ b/shiny/widget/node/node.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Package node provides the structure for a tree of heterogenous widget nodes.
+// Package node provides the structure for a tree of heterogeneous widget nodes.
//
// Most programmers should not need to import this package, only the top-level
// widget package. Only those that write custom widgets need to explicitly
@@ -13,7 +13,7 @@
// Embed), providing default implementations of all of Node's methods.
//
// The split between an outer wrapper (Node) interface type and an inner
-// wrappee (Embed) struct type enables heterogenous nodes, such as a buttons
+// wrappee (Embed) struct type enables heterogeneous nodes, such as a buttons
// and labels, in a widget tree where every node contains common fields such as
// position, size and tree structure links (parent, siblings and children).
//
@@ -126,7 +126,7 @@
// responsible for calling PaintBase on this node (and its children). In
// any case, the Paint method should then paint any effects. Many widgets
// will neither create their own buffers nor have any effects, so their
- // Paint methods will simply be the default implemention: do nothing except
+ // Paint methods will simply be the default implementation: do nothing except
// call Paint on its children. As mentioned above, the bulk of the work is
// typically done in PaintBase.
//
diff --git a/shiny/widget/sheet.go b/shiny/widget/sheet.go
index f55696b..8528a1f 100644
--- a/shiny/widget/sheet.go
+++ b/shiny/widget/sheet.go
@@ -18,7 +18,7 @@
// Sheet is a shell widget that provides *image.RGBA pixel buffers (analogous
// to blank sheets of paper) for its descendent widgets to paint on, via their
-// PaintBase methods. Such buffers may be cached and their contents re-used for
+// PaintBase methods. Such buffers may be cached and their contents reused for
// multiple paints, which can make scrolling and animation smoother and more
// efficient.
//
diff --git a/shootout/chameneosredux.c b/shootout/chameneosredux.c
index cb7d94d..08ed394 100644
--- a/shootout/chameneosredux.c
+++ b/shootout/chameneosredux.c
@@ -286,7 +286,7 @@
/* print total meeting times, should equal n_meeting */
printf( "%s\n\n", formatNumber(total, str) );
- /* cleaup & quit */
+ /* cleanup & quit */
pthread_mutex_destroy( &place.mutex );
free( creatures );
}
diff --git a/shootout/meteor-contest.c b/shootout/meteor-contest.c
index dda181b..bdc7112 100644
--- a/shootout/meteor-contest.c
+++ b/shootout/meteor-contest.c
@@ -188,7 +188,7 @@
}
}
-/* Returns wether the specified cell and direction will land outside
+/* Returns whether the specified cell and direction will land outside
* of the board. Used to determine if a piece is at a legal board
* location or not.
*/
diff --git a/shootout/meteor-contest.go b/shootout/meteor-contest.go
index cfe49ec..eec08ac 100644
--- a/shootout/meteor-contest.go
+++ b/shootout/meteor-contest.go
@@ -206,7 +206,7 @@
return cell
}
-/* Returns wether the specified cell and direction will land outside
+/* Returns whether the specified cell and direction will land outside
* of the board. Used to determine if a piece is at a legal board
* location or not.
*/
diff --git a/slices/slices_test.go b/slices/slices_test.go
index e55be15..4e4f2d6 100644
--- a/slices/slices_test.go
+++ b/slices/slices_test.go
@@ -933,7 +933,7 @@
singleton := []string{"one"}
Reverse(singleton)
if want := []string{"one"}; !Equal(singleton, want) {
- t.Errorf("Reverse(singeleton) = %v, want %v", singleton, want)
+ t.Errorf("Reverse(singleton) = %v, want %v", singleton, want)
}
Reverse[[]string](nil)
diff --git a/trace/flightrecorder.go b/trace/flightrecorder.go
index 17d5d57..14626a6 100644
--- a/trace/flightrecorder.go
+++ b/trace/flightrecorder.go
@@ -5,7 +5,7 @@
//go:build go1.22
/*
-Package trace provides a mechanism to collect and retrive
+Package trace provides a mechanism to collect and retrieve
the most recent execution data without keeping the complete
execution tracing history.
diff --git a/typeparams/common.go b/typeparams/common.go
index 7f867cf..820ca7b 100644
--- a/typeparams/common.go
+++ b/typeparams/common.go
@@ -116,7 +116,7 @@
// implements the following rule for uninstantiated generic types:
//
// If V and T are generic named types, then V is considered assignable to T if,
-// for every possible instantation of V[A_1, ..., A_N], the instantiation
+// for every possible instantiation of V[A_1, ..., A_N], the instantiation
// T[A_1, ..., A_N] is valid and V[A_1, ..., A_N] implements T[A_1, ..., A_N].
//
// If T has structural constraints, they must be satisfied by V.
diff --git a/typeparams/example/README.md b/typeparams/example/README.md
index afe5bfb..7be3789 100644
--- a/typeparams/example/README.md
+++ b/typeparams/example/README.md
@@ -43,7 +43,7 @@
- The [original proposal](https://go.dev/issue/43651) for type parameters.
- The [addendum for type sets](https://go.dev/issue/45346).
-- The [latest language specfication](https://tip.golang.org/ref/spec) (still in-progress as of 2021-01-11).
+- The [latest language specification](https://tip.golang.org/ref/spec) (still in-progress as of 2021-01-11).
- The proposals for new APIs in
[go/token and go/ast](https://go.dev/issue/47781), and in
[go/types](https://go.dev/issue/47916).
@@ -385,7 +385,7 @@
We can also investigate two new methods of interface:
`types.Interface.IsComparable`, which reports whether the type set of an
interface is comparable, and `types.Interface.IsMethodSet`, which reports
-whether an interface is expressable using methods alone.
+whether an interface is expressible using methods alone.
```
func PrintInterfaceTypes(fset *token.FileSet, file *ast.File) error {
@@ -430,7 +430,7 @@
```
The `Findable` type demonstrates another new feature of Go 1.18: the comparable
-built-in. Comparable is a special interface type, not expressable using
+built-in. Comparable is a special interface type, not expressible using
ordinary Go syntax, whose type-set consists of all comparable types.
### Implicit interfaces
@@ -697,7 +697,7 @@
Methods on uninstantiated generic types are different from methods on an
ordinary type. Consider that for an ordinary type `T`, the receiver base type
of each method in its method set is `T`. However, this can't be the case for
-a generic type: generic types cannot be used without instantation, and neither
+a generic type: generic types cannot be used without instantiation, and neither
can the type of the receiver variable. Instead, the receiver base type is an
_instantiated_ type, instantiated with the method's receiver type parameters.
diff --git a/typeparams/example/generic-go-types.md b/typeparams/example/generic-go-types.md
index 797dcd4..39ef4d0 100644
--- a/typeparams/example/generic-go-types.md
+++ b/typeparams/example/generic-go-types.md
@@ -33,7 +33,7 @@
- The [original proposal](https://go.dev/issue/43651) for type parameters.
- The [addendum for type sets](https://go.dev/issue/45346).
-- The [latest language specfication](https://tip.golang.org/ref/spec) (still in-progress as of 2021-01-11).
+- The [latest language specification](https://tip.golang.org/ref/spec) (still in-progress as of 2021-01-11).
- The proposals for new APIs in
[go/token and go/ast](https://go.dev/issue/47781), and in
[go/types](https://go.dev/issue/47916).
@@ -206,7 +206,7 @@
We can also investigate two new methods of interface:
`types.Interface.IsComparable`, which reports whether the type set of an
interface is comparable, and `types.Interface.IsMethodSet`, which reports
-whether an interface is expressable using methods alone.
+whether an interface is expressible using methods alone.
%include interfaces/main.go printtypes -
@@ -215,7 +215,7 @@
%include interfaces/main.go outputtypes -
The `Findable` type demonstrates another new feature of Go 1.18: the comparable
-built-in. Comparable is a special interface type, not expressable using
+built-in. Comparable is a special interface type, not expressible using
ordinary Go syntax, whose type-set consists of all comparable types.
### Implicit interfaces
@@ -346,7 +346,7 @@
Methods on uninstantiated generic types are different from methods on an
ordinary type. Consider that for an ordinary type `T`, the receiver base type
of each method in its method set is `T`. However, this can't be the case for
-a generic type: generic types cannot be used without instantation, and neither
+a generic type: generic types cannot be used without instantiation, and neither
can the type of the receiver variable. Instead, the receiver base type is an
_instantiated_ type, instantiated with the method's receiver type parameters.
diff --git a/utf8string/string.go b/utf8string/string.go
index 281d5ac..57a5dd9 100644
--- a/utf8string/string.go
+++ b/utf8string/string.go
@@ -13,8 +13,8 @@
// String wraps a regular string with a small structure that provides more
// efficient indexing by code point index, as opposed to byte index.
// Scanning incrementally forwards or backwards is O(1) per index operation
-// (although not as fast a range clause going forwards). Random access is
-// O(N) in the length of the string, but the overhead is less than always
+// (although not as fast as a range clause going forwards).
+// Random access is O(N) in the length of the string, but the overhead is less than always
// scanning from the beginning.
// If the string is ASCII, random access is O(1).
// Unlike the built-in string type, String has internal mutable state and