The snippet library.
Small, practical examples. Search by task or narrow things down below.
Calculate a SHA-256 text digest
Calculate a SHA-256 text digest using a complete Go program with explicit sample inputs.
Go✓ Tested
Decode JSON into a typed struct
Decode JSON into a typed struct using a complete Go program with explicit sample inputs.
Go✓ Tested
Encode a struct with JSON field names
Encode a struct with JSON field names using a complete Go program with explicit sample inputs.
Go✓ Tested
Encode and decode Base64 text
Encode and decode Base64 text using a complete Go program with explicit sample inputs.
Go✓ Tested
Encode bytes as hexadecimal
Encode bytes as hexadecimal using a complete Go program with explicit sample inputs.
Go✓ Tested
Preserve a large JSON integer
Preserve a large JSON integer using a complete Go program with explicit sample inputs.
Go✓ Tested
Read a big-endian integer from bytes
Read a big-endian integer from bytes using a complete Go program with explicit sample inputs.
Go✓ Tested
Read quoted CSV fields
Read quoted CSV fields using a complete Go program with explicit sample inputs.
Go✓ Tested
Reject unknown JSON object fields
Reject unknown JSON object fields using a complete Go program with explicit sample inputs.
Go✓ Tested