Checking for a nil value is very common in GO programs so it is important to know the difference between checking nil on a given type and checking nil on an interface{} object.
Let's start with an example:
package main
import "fmt"
func GiveMeANil(value *string) {
if value == nil {...
There are 3 ways people use to close a response body and I call them The Good, The Bad and The Ugly way.
It is not rare to find code like this:
resp,err := http.Get("https://mysite.com")
defer resp.Body.Close()
if err != nil {
// handle error
return e...
Suppose you have a slice declared as:
names := []string{"Manyanda", "Abhishek", "Pawel", "Eoin", "Jameel", "Vincent", "Jason", "Massimo"}
and a printSlice function that prints the first count element of the passed in slice implemented like this:
func printSlice(slice []*string, count int)...