FIND YOUR NEXT FEW LINES

Results for “Go”

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

182 snippets foundClear filters
GoErrors & validation

Return a descriptive validation error

Return a descriptive validation error using a complete Go program with explicit sample inputs.

Go✓ Tested
GoGetting Started

Return two values from a function

Return two values from a function using a complete Go program with explicit sample inputs.

Go✓ Tested
GoSlices & collections

Reverse slice order

Reverse slice order using a complete Go program with explicit sample inputs.

Go✓ Tested
C++Sequence algorithms

Rotate a sequence around a selected position

C++: rotate places the element at the middle iterator first while preserving the two segment orders.

C++✓ Tested
GoDates & times

Round down to a whole minute

Round down to a whole minute using a complete Go program with explicit sample inputs.

Go✓ Tested
GoGetting Started

Run cleanup when a function returns

Run cleanup when a function returns using a complete Go program with explicit sample inputs.

Go✓ Tested
GoTesting & reusable helpers

Scan whitespace-separated tokens

Scan whitespace-separated tokens using a complete Go program with explicit sample inputs.

Go✓ Tested
GoHTTP & URLs

Send a JSON HTTP response

Send a JSON HTTP response using a complete Go program with explicit sample inputs.

Go✓ Tested
GoFiles & paths

Separate a filename extension

Separate a filename extension using a complete Go program with explicit sample inputs.

Go✓ Tested
GoHTTP & URLs

Set and retrieve an HTTP header

Set and retrieve an HTTP header using a complete Go program with explicit sample inputs.

Go✓ Tested
GoSlices & collections

Sort integers in place

Sort integers in place using a complete Go program with explicit sample inputs.

Go✓ Tested
GoMaps & sets

Sort map keys for stable output

Sort map keys for stable output using a complete Go program with explicit sample inputs.

Go✓ Tested