[68] Results

Golang : How to pass map to html template and access the map's elements

golang index panic-assignment-to-entry-in-nil-map html-text-template slice-array

For this tutorial, we will learn how to pass a map to text or html template and learn how to….... read more

Golang : io.Reader causing panic: runtime error: invalid memory address or nil pointer dereference

golang reset-io-reader panic-runtime-error invalid-memory nil-pointer-dereference

Problem :

You read a file to retrieve some data with io.Reader, then when you attempt to read the same….... read more

Golang : Sort words with first uppercase letter

golang sort-words uppercase map replace-element-in-slice tag


You use the sort.Strings() function to sort a slice of words. However, you noticed that words with the first….... read more

Golang : How to convert JSON string to map and slice

golang json-to-map json-to-slice array

Couple of simple examples on how to convert JSON string to map and slice(array).

Simple and straightforward way of converting….... read more

Golang : Reset or rewind io.Reader or io.Writer

golang io-reader io-writer seek panic-runtime-error invalid-memory nil-pointer-dereference

Problem :

You have read file with io.Reader till EOF. Or you want to rewrite a file with io.Writer again.….... read more

Golang : Gorilla web tool kit schema example

golang schema data-map-to-object gorilla

This is an example on how to use Gorilla web tool kit Schema package. The Schema package is….... read more

Golang : Get all countries phone codes

golang json-unmarshal-to-map countries-phone-codes iso

Continue from previous tutorial where we learn how to get all the currencies names, but this time it….... read more

Golang : Display list of countries and ISO codes

golang json-unmarshal-to-map countries-name iso

The code example below will download the JSON formatted data from http://country.io/names.json and unmarshal the data to display a list….... read more