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)
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
}
}
-// 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)
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()
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()
"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.
}
}
-// 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 {
// 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 {
// 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.
// 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)
}
// 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{
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) {
}
// 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;
}
}
-// 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{})
}
// 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()
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()
// 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) {
err := Unmarshal([]byte("<T><A>1</A></T>"), nilPointer)
if err == nil {
- t.Fatalf("no error in unmarshalling")
+ t.Fatalf("no error in unmarshaling")
}
}
}
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
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)
“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:
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" {
// 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
// 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()
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:
}
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...)
// 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).
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:
}
// 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})
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
// 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
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)
} 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",
})
// 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")
}
})
- // 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.
}
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)
// 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.
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.
}
}
-// panicHanding controls the panic handling used by runCleanup.
+// panicHandling controls the panic handling used by runCleanup.
type panicHandling int
const (
"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) {
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)
}
// Nodes returns the rooms connected by an edge.
+//
//go:noinline
func (e mazeEdge) Nodes() (mazeRoom, mazeRoom) {
m1, ok := zork[e.from]
"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