Golang Code Examples

Learn Golang programming by example. GOSAMPLES is a library of Golang code snippets that let you solve everyday code problems.

📁 Create a directory in Go

Learn how to create a single or a hierarchy of directories
introduction file

📎 Convert JSON to CSV in Go

Learn how to transform JSON file to CSV
introduction file json csv

🗄️ Unzip a file in Go

Learn how to uncompress a zip file
compression file zip

🖐️ Declare enum in Go

Learn how to declare and use enums
introduction enum iota const

🧐 iota in Go - how to use?

Learn how to use iota keyword in constants declaration
introduction iota const

💡 Empty slice vs nil slice in Go

Learn what is the difference between empty and nil slice and when to use them
introduction slice

📰 String padding in Go

Learn how to print aligned strings padded with spaces
introduction strings format

🗜️ Zip a file in Go

Learn how to compress a file or folder into zip format
compression file zip

🍕 Compare two slices in Go

Learn how to check if two slices are equal
introduction slice strings

⌛ Temporary file in Go - how to create?

Learn how to create and use a temporary file or folder
introduction file
1 ... 2 ... 5