Golang Code Examples

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

🏁 Check if a string starts with a substring in Go

Learn how to use strings.HasPrefix() function
introduction strings

✍️ Write to a file in Go

Learn how to write any data to a file
introduction file

📖 Read a file in Go

Learn how to read the content of any file
introduction file

🔢 Generate a random number in Go

Learn how to generate a random number
introduction random

🍃 Get, set, list and other operations on environment variables in Golang

Learn how to work with environment variables
introduction environment variables