Explore
All 8765 published resources across 16 types — search, filter and jump into the one you need.
Applying filters…
Resources
Swap Immutable Snapshots With atomic.Pointer
Publish updated RouteTable structs via atomic.Pointer.Swap so readers holding earlier Load pointers keep reading consistent immutable snapshots.
Encode Unpadded URL Tokens With RawURLEncoding
Encode binary tokens cleanly with base64.RawURLEncoding and hex.EncodeToString, showing how unpadded decoders reject trailing equals signs.
Decode BigEndian Packet Headers Safely
Decode fixed-width BigEndian packet headers and length-prefixed payloads with encoding/binary, rejecting truncated frames or magic mismatches.
Sniff Headers And Frame Records With bufio.Reader
Inspect leading bytes with bufio.Reader.Peek without advancing the cursor, then split records via ReadBytes while handling a trailing io.EOF.
Track Bounded Evictions With container/list
Combine container/list with an index map to promote accessed entries in O(1) time and record evicted keys when inserting past max capacity.
Unregister Cleanup With context.AfterFunc Stop
Attach a cancel hook with context.AfterFunc to close an in-flight resource, and unregister the hook via defer stop() when work finishes early.
Parse Pipe-Delimited Records With encoding/csv
Configure csv.Reader with a pipe Comma, hash Comment, and TrimLeadingSpace, then normalize whitespace and re-export the rows as TSV.
Inspect Multi-Error Trees With errors.Join And Unwrap
Build a nested multi-error tree with errors.Join and fmt.Errorf %w, then traverse both Unwrap() []error and Unwrap() error branches recursively.
Walk An Isolated Subtree With fs.Sub And WalkDir
Mount a narrow directory view with fs.Sub, prune temporary folders via fs.WalkDir and fs.SkipDir, and verify parent escapes fail.
Schedule Retries By Deadline With container/heap
Order pending retry jobs by earliest deadline and ID tie-breaker using container/heap, popping due work and pushing backed-off attempts.
Verify Webhook Signatures With hmac.Equal
Sign canonical webhook payloads using crypto/hmac with SHA-256 and validate hex signatures in constant time via hmac.Equal against tampering.
Write Disjoint Regions With io.OffsetWriter
Wrap an io.WriterAt buffer with io.NewOffsetWriter to write header, payload, and footer sections at independent offsets using io.Writer and Seek.
Stream Data And Errors Across io.Pipe
Copy bytes from a producer goroutine through io.Pipe and propagate failures explicitly via CloseWithError instead of a silent EOF.
Hash And Mirror Reads With TeeReader And MultiWriter
Wire io.TeeReader into io.MultiWriter so a single io.Copy hashes incoming bytes with SHA-256 and CRC-32 while writing two output destinations.
Parse RFC 5322 Messages With mail.ReadMessage
Parse RFC 5322 headers, sender and recipient lists, timestamps, and message body streams from an in-memory reader using net/mail.ReadMessage.
Compile Regex Once With sync.OnceValue
Defer compiling a regexp until first validation with sync.OnceValue, so concurrent goroutines share one compiled matcher without manual locks.
Multiplex Dynamic Channels With reflect.Select
Combine a runtime slice of channels into []reflect.SelectCase using reflect.Select, handling default fallback and pruning closed channels safely.
Bind Struct Fields From Lookup Tags
Inspect env and default struct tags via reflect.StructTag.Lookup to populate typed string, int, and bool fields from a key-value map cleanly.
Track A Rolling Window With container/ring
Maintain a fixed-capacity latency window in container/ring, overwriting the oldest slot and ignoring unfilled nil nodes during summary scans.
Batch Items Safely With slices.Chunk And cmp.Or
Combine cmp.Or fallback defaults, maps.Clone per-batch isolation, and slices.Chunk iteration to dispatch fixed-size slices cleanly.
Find Tier Thresholds With sort.Search
Assert ascending monotonicity with sort.SliceIsSorted, then use sort.Search to match usage metrics against threshold tiers and handle overflows.
Format Records Into Reused Buffers With AppendInt
Build structured telemetry lines in a preallocated byte slice using strconv.AppendInt for decimal and hex fields while keeping buffer capacity fixed.
Deduplicate Concurrent Writes With sync.Map LoadOrStore
Coordinate concurrent goroutines with sync.Map.LoadOrStore so only one winner initializes each shared key while peers receive the existing value.
Combine FuncMap With Strict MissingKey
Register custom text/template FuncMap helpers and contrast missingkey=zero against missingkey=error so absent keys either default cleanly or fail.
Decode MIME Headers And Dot Blocks With textproto
Parse MIME headers with net/textproto ReadMIMEHeader and decode dot-stuffed text blocks via DotReader, stopping cleanly at the terminator line.
Stop And Safely Drain A time.Timer
Stop an active or expired time.Timer and drain its channel with a non-blocking select before Reset so stale ticks never fire early.
Detect Mixed Scripts With unicode.In RangeTables
Inspect identifier runes against unicode.Latin, unicode.Cyrillic, and custom Range16 tables via unicode.In to block mixed-script spoofing attempts.
Validate Redirects With URL.ResolveReference
Resolve relative, protocol-relative, and external redirect strings against a base net/url.URL, then enforce same-scheme and same-host checks.
Distinguish RuneError Bytes With DecodeRuneInString
Scan raw strings via utf8.DecodeRuneInString so invalid byte runs (RuneError with width 1) are separated from genuine U+FFFD runes (width 3).
CheckedInputStream With Adler32 Checksum
Compute and verify rolling Adler32 checksums in-flight with CheckedOutputStream and CheckedInputStream, catching single-bit stream tampering.
BigDecimal StripTrailingZeros And PlainString
Normalize trailing zeros with BigDecimal.stripTrailingZeros and print plain numbers via toPlainString so powers of ten never show 1E+2.
BitSet Range Flip And Intersects Checks
Toggle half-open slot ranges in BitSet with set(from, to), flip(from, to), and clear(from, to), then test schedule overlap via intersects.
BlockingQueue Take Plus DrainTo Batching
Block with take() for the first queued item, then coalesce all ready elements via drainTo in one consumer pass instead of spinning or polling.
ByteBuffer AsReadOnlyBuffer And Duplicate Views
Share buffer bytes across independent cursors with duplicate() and hand untrusted callers immutable views via asReadOnlyBuffer() safely.
ByteBuffer Slice And Flip Sub-Views
Flip a ByteBuffer after writing and carve independent sub-views with slice() and slice(index, length) that share bytes without moving parent positions.
Class.isSealed And PermittedSubclasses Check
Inspect sealed interfaces at runtime with Class.isSealed() and getPermittedSubclasses() to build a closed allowlist before reflection dispatch.
No resources match your current search or filters. Try removing a filter or clearing all.