How to Use WaitGroups in Golang
Initiate a new wait group variable: Add how many goroutines you want to wait for: In each goroutine call the Done() function at the end… Read More »How to Use WaitGroups in Golang
Initiate a new wait group variable: Add how many goroutines you want to wait for: In each goroutine call the Done() function at the end… Read More »How to Use WaitGroups in Golang
The standard time package in Golang has many helper functions that can help you when you dealing with time conversion. Unix() function accepts an integer… Read More »Golang: How to Parse Unix Timestamp to time Type
Google has a package to generate a UUID compatible with RFC 4122 and DCE 1.1. Add it to your project: Generating UUIDs:
Sorting a slice in golang is easy and the “sort” package is your friend. Sort package has a Slice() method: In this code example, we… Read More »Sort a Slice of Structs by a Field in Go
When you read a response it is in []byte format but you can convert it to string simply by using string() function: Use this snippet… Read More »Golang: Get HTTP Response as a String
In Golang, we have lots of flags that can help us during running and testing software. By adding -run to your test command you can… Read More »Golang: How to run only a specific test?
Create a new Decoder from json package and pass the request body to it! Simple, simple, simple. Try this snippet and enjoy:
Iterating over the keys of a map in Golang is so easy and you can do it by using a for-range loop. The only difference… Read More »Go: How to Iterate Over All the Keys of a Map?
Yes, a string is a slice then you can iterate over it easily. Take a look at this snippet which helps you to reverse a… Read More »Reverse Function for String in Golang?
If you want to check the equality of two slices and the order is important then this snippet will save your time: