1
0
mirror of https://github.com/golang/go synced 2024-11-22 10:34:46 -07:00

all: fix a large number of comments

Partial typo corrections, following https://go.dev/wiki/Spelling

Change-Id: I2357906ff2ea04305c6357418e4e9556e20375d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/573776
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
cui fliter 2024-03-22 23:31:44 +08:00 committed by Gopher Robot
parent 4217877670
commit 1e12eab870
31 changed files with 45 additions and 44 deletions

View File

@ -338,7 +338,7 @@ func dumpFnPreamble(w io.Writer, funcInlHeur *fnInlHeur, ecst encodedCallSiteTab
fmt.Fprintf(w, "%s// %s\n", funcInlHeur.props.ToString("// "), comDelimiter)
data, err := json.Marshal(funcInlHeur.props)
if err != nil {
return fmt.Errorf("marshall error %v\n", err)
return fmt.Errorf("marshal error %v\n", err)
}
fmt.Fprintf(w, "// %s\n", string(data))
dumpCallSiteComments(w, funcInlHeur.cstab, ecst)

View File

@ -40,7 +40,7 @@ func genLinear(size int) []bloc {
return blocs
}
// genLinear creates an array of blocks that alternate between
// genFwdBack creates an array of blocks that alternate between
// b_n -> [b_n+1], b_n -> [b_n+1, b_n-1] , b_n -> [b_n+1, b_n+2]
func genFwdBack(size int) []bloc {
var blocs []bloc

View File

@ -47,7 +47,7 @@ func benchFnPass(b *testing.B, fn passFunc, size int, bg blockGen) {
}
}
// benchFnPass runs passFunc across a function with b.N blocks.
// benchFnBlock runs passFunc across a function with b.N blocks.
func benchFnBlock(b *testing.B, fn passFunc, bg blockGen) {
b.ReportAllocs()
c := testConfig(b)

View File

@ -166,7 +166,7 @@ func TestPGOIntendedInlining(t *testing.T) {
testPGOIntendedInlining(t, dir, profFile)
}
// TestPGOIntendedInlining tests that specific functions are inlined when PGO
// TestPGOPreprocessInlining tests that specific functions are inlined when PGO
// is applied to the exact source that was profiled.
func TestPGOPreprocessInlining(t *testing.T) {
wd, err := os.Getwd()
@ -187,7 +187,7 @@ func TestPGOPreprocessInlining(t *testing.T) {
testPGOIntendedInlining(t, dir, preProfFile)
}
// TestPGOIntendedInlining tests that specific functions are inlined when PGO
// TestPGOIntendedInliningShiftedLines tests that specific functions are inlined when PGO
// is applied to the modified source.
func TestPGOIntendedInliningShiftedLines(t *testing.T) {
wd, err := os.Getwd()

View File

@ -9,7 +9,7 @@ import (
"testing"
)
// TestSupportedBuildModes tests that dist and the main tools agree on
// TestSupported tests that dist and the main tools agree on
// which build modes are supported for a given target. We do things
// this way because the dist tool needs to be buildable directly by
// the bootstrap compiler, and as such can't import internal packages.

View File

@ -1592,7 +1592,7 @@ func raceDetectorSupported(goos, goarch string) bool {
}
}
// buildModeSupports is a copy of the function
// buildModeSupported is a copy of the function
// internal/platform.BuildModeSupported, which can't be used here
// because cmd/dist can not import internal packages during bootstrap.
func buildModeSupported(compiler, buildmode, goos, goarch string) bool {

View File

@ -104,7 +104,7 @@ type parseError struct {
// parseErrorToString converts the error from parsing the file into a string
// representation. A nil error is converted to an empty string, and all other
// errors are converted to a JSON-marshalled parseError struct, with ErrorList
// errors are converted to a JSON-marshaled parseError struct, with ErrorList
// set for errors of type scanner.ErrorList, and ErrorString set to the error's
// string representation for all other errors.
func parseErrorToString(err error) string {
@ -126,7 +126,7 @@ func parseErrorToString(err error) string {
// parseErrorFromString converts a string produced by parseErrorToString back
// to an error. An empty string is converted to a nil error, and all
// other strings are expected to be JSON-marshalled parseError structs.
// other strings are expected to be JSON-marshaled parseError structs.
// The two functions are meant to preserve the structure of an
// error of type scanner.ErrorList in a round trip, but may not preserve the
// structure of other errors.

View File

@ -43,7 +43,7 @@ type moduleErrorNoMethods ModuleError
// UnmarshalJSON accepts both {"Err":"text"} and "text",
// so that the output of go mod download -json can still
// be unmarshalled into a ModulePublic during -reuse processing.
// be unmarshaled into a ModulePublic during -reuse processing.
func (e *ModuleError) UnmarshalJSON(data []byte) error {
if len(data) > 0 && data[0] == '"' {
return json.Unmarshal(data, &e.Err)

View File

@ -916,7 +916,7 @@ func removeAll(dir string) error {
}
// Sleep sleeps for the given Go duration or until the script's context is
// cancelled, whichever happens first.
// canceled, whichever happens first.
func Sleep() Cmd {
return Command(
CmdUsage{

View File

@ -180,7 +180,7 @@ func tbFromContext(ctx context.Context) (testing.TB, bool) {
return t.(testing.TB), true
}
// initScriptState creates the initial directory structure in s for unpacking a
// initScriptDirs creates the initial directory structure in s for unpacking a
// cmd/go script.
func initScriptDirs(t testing.TB, s *script.State) (telemetryDir string) {
must := func(err error) {

View File

@ -295,7 +295,7 @@ func Cause(c Context) error {
}
// AfterFunc arranges to call f in its own goroutine after ctx is done
// (cancelled or timed out).
// (canceled or timed out).
// If ctx is already done, AfterFunc calls f immediately in its own goroutine.
//
// Multiple calls to AfterFunc on a context operate independently;

View File

@ -1064,7 +1064,7 @@ func TestAfterFuncNotCalledAfterStop(t *testing.T) {
}
}
// This test verifies that cancelling a context does not block waiting for AfterFuncs to finish.
// This test verifies that canceling a context does not block waiting for AfterFuncs to finish.
func TestAfterFuncCalledAsynchronously(t *testing.T) {
ctx, cancel := WithCancel(Background())
donec := make(chan struct{})

View File

@ -1040,7 +1040,7 @@ func (c *Conn) writeRecordLocked(typ recordType, data []byte) (int, error) {
}
// writeHandshakeRecord writes a handshake message to the connection and updates
// the record layer state. If transcript is non-nil the marshalled message is
// the record layer state. If transcript is non-nil the marshaled message is
// written to it.
func (c *Conn) writeHandshakeRecord(msg handshakeMessage, transcript transcriptHash) (int, error) {
c.out.Lock()

View File

@ -998,7 +998,7 @@ func TestHandshakeServerSNI(t *testing.T) {
runServerTestTLS12(t, test)
}
// TestHandshakeServerSNICertForName is similar to TestHandshakeServerSNI, but
// TestHandshakeServerSNIGetCertificate is similar to TestHandshakeServerSNI, but
// tests the dynamic GetCertificate method
func TestHandshakeServerSNIGetCertificate(t *testing.T) {
config := testConfig.Clone()

View File

@ -1574,7 +1574,7 @@ var emptyASN1Subject = []byte{0x30, 0}
// The PolicyIdentifier and Policies fields are both used to marshal certificate
// policy OIDs. By default, only the PolicyIdentifier is marshaled, but if the
// GODEBUG setting "x509usepolicies" has the value "1", the Policies field will
// be marshalled instead of the PolicyIdentifier field. The Policies field can
// be marshaled instead of the PolicyIdentifier field. The Policies field can
// be used to marshal policy OIDs which have components that are larger than 31
// bits.
func CreateCertificate(rand io.Reader, template, parent *Certificate, pub, priv any) ([]byte, error) {

View File

@ -1093,7 +1093,7 @@ func TestUnmarshalIntoNil(t *testing.T) {
err := Unmarshal([]byte("<T><A>1</A></T>"), nilPointer)
if err == nil {
t.Fatalf("no error in unmarshalling")
t.Fatalf("no error in unmarshaling")
}
}

View File

@ -1091,10 +1091,10 @@ func TestIssue7113(t *testing.T) {
}
if a.XMLName.Space != structSpace {
t.Errorf("overidding with empty namespace: unmarshalling, got %s, want %s\n", a.XMLName.Space, structSpace)
t.Errorf("overidding with empty namespace: unmarshaling, got %s, want %s\n", a.XMLName.Space, structSpace)
}
if len(a.C.XMLName.Space) != 0 {
t.Fatalf("overidding with empty namespace: unmarshalling, got %s, want empty\n", a.C.XMLName.Space)
t.Fatalf("overidding with empty namespace: unmarshaling, got %s, want empty\n", a.C.XMLName.Space)
}
var b []byte
@ -1106,7 +1106,7 @@ func TestIssue7113(t *testing.T) {
t.Errorf("overidding with empty namespace: marshaling, got %s in C tag which should be empty\n", a.C.XMLName.Space)
}
if string(b) != xmlTest {
t.Fatalf("overidding with empty namespace: marshalling, got %s, want %s\n", b, xmlTest)
t.Fatalf("overidding with empty namespace: marshaling, got %s, want %s\n", b, xmlTest)
}
var c A
err = Unmarshal(b, &c)

View File

@ -24,7 +24,7 @@ The remaining files contain the expected output for the named format generated b
“html” for Printer.HTML, “markdown” for Printer.Markdown, and “text” for Printer.Text.
The format can also be “dump” for a textual dump of the raw data structures.
The text before the `-- input --` line, if present, is JSON to be unmarshalled
The text before the `-- input --` line, if present, is JSON to be unmarshaled
to initialize a comment.Printer. For example, this test case sets the Printer's
TextWidth field to 20:

View File

@ -57,7 +57,7 @@ func TestTestdata(t *testing.T) {
if len(a.Comment) > 0 {
err := json.Unmarshal(a.Comment, &pr)
if err != nil {
t.Fatalf("unmarshalling top json: %v", err)
t.Fatalf("unmarshaling top json: %v", err)
}
}
if len(a.Files) < 1 || a.Files[0].Name != "input" {

View File

@ -171,7 +171,7 @@ func jsValEscaper(args ...any) string {
// cyclic data. This may be an unacceptable DoS risk.
b, err := json.Marshal(a)
if err != nil {
// While the standard JSON marshaller does not include user controlled
// While the standard JSON marshaler does not include user controlled
// information in the error message, if a type has a MarshalJSON method,
// the content of the error message is not guaranteed. Since we insert
// the error into the template, as part of a comment, we attempt to

View File

@ -196,7 +196,7 @@ func CoordinateFuzzing(ctx context.Context, opts CoordinateFuzzingOpts) (err err
// Main event loop.
// Do not return until all workers have terminated. We avoid a deadlock by
// receiving messages from workers even after ctx is cancelled.
// receiving messages from workers even after ctx is canceled.
activeWorkers := len(workers)
statTicker := time.NewTicker(3 * time.Second)
defer statTicker.Stop()
@ -223,8 +223,8 @@ func CoordinateFuzzing(ctx context.Context, opts CoordinateFuzzingOpts) (err err
select {
case <-doneC:
// Interrupted, cancelled, or timed out.
// stop sets doneC to nil so we don't busy wait here.
// Interrupted, canceled, or timed out.
// stop sets doneC to nil, so we don't busy wait here.
stop(ctx.Err())
case err := <-errC:
@ -653,7 +653,7 @@ type coordinator struct {
}
func newCoordinator(opts CoordinateFuzzingOpts) (*coordinator, error) {
// Make sure all of the seed corpus has marshalled data.
// Make sure all the seed corpus has marshaled data.
for i := range opts.Seed {
if opts.Seed[i].Data == nil && opts.Seed[i].Values != nil {
opts.Seed[i].Data = marshalCorpusFile(opts.Seed[i].Values...)

View File

@ -89,7 +89,7 @@ func (w *worker) cleanup() error {
// coordinate runs the test binary to perform fuzzing.
//
// coordinate loops until ctx is cancelled or a fatal error is encountered.
// coordinate loops until ctx is canceled or a fatal error is encountered.
// If a test process terminates unexpectedly while fuzzing, coordinate will
// attempt to restart and continue unless the termination can be attributed
// to an interruption (from a timer or the user).
@ -1026,7 +1026,7 @@ func (wc *workerClient) minimize(ctx context.Context, entryIn CorpusEntry, args
return entryIn, minimizeResponse{}, retErr
}
// An unrecoverable error occurred during minimization. mem now
// holds the raw, unmarshalled bytes of entryIn.Values[i] that
// holds the raw, unmarshaled bytes of entryIn.Values[i] that
// caused the error.
switch entryOut.Values[i].(type) {
case string:
@ -1148,7 +1148,7 @@ func (wc *workerClient) ping(ctx context.Context) error {
}
// callLocked sends an RPC from the coordinator to the worker process and waits
// for the response. The callLocked may be cancelled with ctx.
// for the response. The callLocked may be canceled with ctx.
func (wc *workerClient) callLocked(ctx context.Context, c call, resp any) (err error) {
enc := json.NewEncoder(wc.fuzzIn)
dec := json.NewDecoder(&contextReader{ctx: ctx, r: wc.fuzzOut})
@ -1158,7 +1158,7 @@ func (wc *workerClient) callLocked(ctx context.Context, c call, resp any) (err e
return dec.Decode(resp)
}
// contextReader wraps a Reader with a Context. If the context is cancelled
// contextReader wraps a Reader with a Context. If the context is canceled
// while the underlying reader is blocked, Read returns immediately.
//
// This is useful for reading from a pipe. Closing a pipe file descriptor does

View File

@ -42,7 +42,7 @@ func (eai addrinfoErrno) isAddrinfoErrno() {}
// context is cancellable. It is intended for use with calls that don't support context
// cancellation (cgo, syscalls). blocking func may still be running after this function finishes.
// For the duration of the execution of the blocking function, the thread is 'acquired' using [acquireThread],
// blocking might not be executed when the context gets cancelled early.
// blocking might not be executed when the context gets canceled early.
func doBlockingWithCtx[T any](ctx context.Context, lookupName string, blocking func() (T, error)) (T, error) {
if err := acquireThread(ctx); err != nil {
var zero T

View File

@ -754,7 +754,7 @@ func testTransportMaxConnsPerHostDialCancellation(t *testing.T, mode testMode) {
tr := c.Transport.(*Transport)
tr.MaxConnsPerHost = 1
// This request is cancelled when dial is queued, which preempts dialing.
// This request is canceled when dial is queued, which preempts dialing.
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
SetPendingDialHooks(cancel, nil)

View File

@ -777,7 +777,7 @@ func (c *Cmd) watchCtx(resultc chan<- ctxResult) {
} else if errors.Is(interruptErr, os.ErrProcessDone) {
// The process already finished: we just didn't notice it yet.
// (Perhaps c.Wait hadn't been called, or perhaps it happened to race with
// c.ctx being cancelled.) Don't inject a needless error.
// c.ctx being canceled.) Don't inject a needless error.
} else {
err = wrappedError{
prefix: "exec: canceling Cmd",

View File

@ -1366,7 +1366,7 @@ func TestWaitInterrupt(t *testing.T) {
})
// With a very long WaitDelay and no Cancel function, we should wait for the
// process to exit even if the command's Context is cancelled.
// process to exit even if the command's Context is canceled.
t.Run("WaitDelay", func(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skipf("skipping: os.Interrupt is not implemented on Windows")
@ -1404,7 +1404,7 @@ func TestWaitInterrupt(t *testing.T) {
}
})
// If the context is cancelled and the Cancel function sends os.Kill,
// If the context is canceled and the Cancel function sends os.Kill,
// the process should be terminated immediately, and its output
// pipes should be closed (causing Wait to return) after WaitDelay
// even if a child process is still writing to them.

View File

@ -247,7 +247,7 @@ type pkfunc struct {
}
func (ts *tstate) readAuxMetaFiles(metafiles string, importpaths map[string]struct{}) error {
// Unmarshall the information on available aux metafiles into
// Unmarshal the information on available aux metafiles into
// a MetaFileCollection struct.
var mfc coverage.MetaFileCollection
data, err := os.ReadFile(metafiles)

View File

@ -249,7 +249,7 @@ func netpollQueueTimer(delay int64) (signaled bool) {
// A wait completion packet can only be associated with one timer at a time,
// so we need to cancel the previous one if it exists. This wouldn't be necessary
// if the poller would only be woken up by the timer, in which case the association
// would be automatically cancelled, but it can also be woken up by other events,
// would be automatically canceled, but it can also be woken up by other events,
// such as a netpollBreak, so we can get to this point with a timer that hasn't
// expired yet. In this case, the completion packet can still be picked up by
// another thread, so defer the cancellation until it is really necessary.
@ -271,7 +271,7 @@ func netpollQueueTimer(delay int64) (signaled bool) {
throw("runtime: netpoll failed")
}
case STATUS_PENDING:
// STATUS_PENDING is returned if the wait operation can't be cancelled yet.
// STATUS_PENDING is returned if the wait operation can't be canceled yet.
// This can happen if this thread was woken up by another event, such as a netpollBreak,
// and the timer expired just while calling NtCancelWaitCompletionPacket, in which case
// this call fails to cancel the association to avoid a race condition.

View File

@ -1306,7 +1306,7 @@ func (c *common) Setenv(key, value string) {
}
}
// panicHanding controls the panic handling used by runCleanup.
// panicHandling controls the panic handling used by runCleanup.
type panicHandling int
const (

View File

@ -11,7 +11,7 @@ import (
"fmt"
)
// _Equal reports whether two slices are equal: the same length and all
// _SliceEqual reports whether two slices are equal: the same length and all
// elements equal. All floating point NaNs are considered equal.
func _SliceEqual[Elem comparable](s1, s2 []Elem) bool {
if len(s1) != len(s2) {
@ -42,7 +42,7 @@ type _NodeC[_Edge any] interface {
Edges() []_Edge
}
// Edgec is the constraints on an edge in a graph, given the _Node type.
// _EdgeC is the constraints on an edge in a graph, given the _Node type.
type _EdgeC[_Node any] interface {
comparable
Nodes() (a, b _Node)
@ -153,6 +153,7 @@ func (m mazeRoom) Edges() []mazeEdge {
}
// Nodes returns the rooms connected by an edge.
//
//go:noinline
func (e mazeEdge) Nodes() (mazeRoom, mazeRoom) {
m1, ok := zork[e.from]

View File

@ -14,7 +14,7 @@ import (
"strconv"
)
// Element is an element of a linked list.
// _Element is an element of a linked list.
type _Element[T any] struct {
// Next and previous pointers in the doubly-linked list of elements.
// To simplify the implementation, internally a list l is implemented