FIND YOUR NEXT FEW LINES

Results for “Go”

Small, practical examples. Search by task or narrow things down below.

182 snippets foundClear filters
GoDates & times

Format a UTC timestamp

Format a UTC timestamp using a complete Go program with explicit sample inputs.

Go✓ Tested
CSmall algorithms & bit operations

Generate a bounded Fibonacci sequence

C: Keep only the two previous values instead of using exponential recursive calls.

C✓ Tested
GoGetting Started

Group fields in a struct

Group fields in a struct using a complete Go program with explicit sample inputs.

Go✓ Tested
GoGetting Started

Handle a failed conversion

Handle a failed conversion using a complete Go program with explicit sample inputs.

Go✓ Tested
GoConcurrency & cancellation

Increment an atomic counter

Increment an atomic counter using a complete Go program with explicit sample inputs.

Go✓ Tested
GoConcurrency & cancellation

Initialize a resource only once

Initialize a resource only once using a complete Go program with explicit sample inputs.

Go✓ Tested
GoErrors & validation

Inspect a typed conversion error

Inspect a typed conversion error using a complete Go program with explicit sample inputs.

Go✓ Tested
GoFunctions & types

Inspect a value with a type switch

Inspect a value with a type switch using a complete Go program with explicit sample inputs.

Go✓ Tested
GoGetting Started

Inspect a value’s type

Inspect a value’s type using a complete Go program with explicit sample inputs.

Go✓ Tested
GoSlices & collections

Iterate over bounded chunks

Iterate over bounded chunks using a complete Go program with explicit sample inputs.

Go✓ Tested
GoFiles & paths

Join portable path components

Join portable path components using a complete Go program with explicit sample inputs.

Go✓ Tested
GoStrings & text

Join words with a separator

Join words with a separator using a complete Go program with explicit sample inputs.

Go✓ Tested