The snippet library.
Small, practical examples. Search by task or narrow things down below.
Clear all map entries
Clear all map entries using a complete Go program with explicit sample inputs.
Go✓ Tested
Clone a map before editing it
Clone a map before editing it using a complete Go program with explicit sample inputs.
Go✓ Tested
Compare map contents
Compare map contents using a complete Go program with explicit sample inputs.
Go✓ Tested
Copy entries into another map
Copy entries into another map using a complete Go program with explicit sample inputs.
Go✓ Tested
Count repeated words
Count repeated words using a complete Go program with explicit sample inputs.
Go✓ Tested
Delete a map entry
Delete a map entry using a complete Go program with explicit sample inputs.
Go✓ Tested
Distinguish missing keys from zero values
Distinguish missing keys from zero values using a complete Go program with explicit sample inputs.
Go✓ Tested
Represent a set with empty structs
Represent a set with empty structs using a complete Go program with explicit sample inputs.
Go✓ Tested
Sort map keys for stable output
Sort map keys for stable output using a complete Go program with explicit sample inputs.
Go✓ Tested