_samples

command
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: BSD-3-Clause Imports: 33 Imported by: 0

Documentation

Overview

Two sibling closures each declaring a func-local anonymous struct with the same field names but different field types must not share a type symbol key. The collision left the first literal's Fnew unpatched (nil slice), so building it panicked with "reflect: slice index out of range".

Assigning a method's struct-field return to a captured variable must store a detached copy in the closure cell, not a reflect value aliasing the source field: a later reset of the field (e.g. a pooled object reuse) must not mutate the captured variable. Was zerolog TestSlogHandler_HandlePropagatesContext.

This example demonstrates an integer heap built using the heap interface.

A map composite literal with interface{} values must store raw Go values, not boxed vm.Iface wrappers, so native reflect-based code (json.Marshal) sees the concrete values.

Regression test: %#v on a slice whose element is a defined type with a Format method must qualify the type name and dispatch each element through the user Format body.

An interpreted type satisfying slog.Handler (and slog.LogValuer) across the native boundary: slog.New dispatches Enabled/Handle/WithAttrs/WithGroup via synth method stubs (shapes S32-S36).

Regression test: closure-in-struct dispatch under fmt.Sprintf("%+v") on a recursively wrapped error chain. Mirrors pkg/errors' TestFormatGeneric shape so the bridged Format path stays exercised.

Regression test: closure stored in a struct field, iterated via for-range across nested recursion. Each wrap closure must run its own body; tag and fn must stay in sync.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL