Tutorials
Golang : Print leading(padding) zero or spaces in fmt.Printf?
Problem :
You want to include leading zero or spaces in front(prefix) of integer when printing out with fmt.Println()
or….... read more
Golang : How to check for empty array string or string?
Sometimes that most obvious thing can be the hardest to remember. Putting this down as a note for myself and….... read more
Golang : Image to ASCII art example
This tutorial is just for fun and want to relive my DOS programming days for a while. In this tutorial,….... read more
Golang : Time slice or date sort and reverse sort example
Sorting time.Time
type and dates is pretty straight forward in Golang. Just curious why it is not included in the….... read more
Golang : ISO8601 Duration Parser example
An example on how to parse ISO-8601 duration in string format and convert it to time.Duration
type. However, this example….... read more
Golang : Convert date or time stamp from string to time.Time type
Problem :
You have dates or time stamps in string format(usually from database) and you want to convert them into….... read more
Golang : How to get hour, minute, second from time?
Problem :
You have unix timestamp or time stamp in string format. You want to convert the unix timestamps from….... read more
Golang : How to get year, month and day?
Problem :
You want to extract the year, month and day from today's date. How to do that?
Solution :
….... read moreGolang : How to get time zone and load different time zone?
Problem :
You need to get current time zone and load different time zone. How to do that in Golang?
….... read moreGolang : Levenshtein distance example
Continue from previous tutorial on fuzzy string search. This is a short example on Levenshtein distance with .... read more
Golang : Fuzzy string search or approximate string matching example
For this tutorial, we will learn how to do a fuzzy search in Golang. Fuzzy search or approximate string matching….... read more
Golang : "https://" not allowed in import path
Problem :
Attempt to go get
packages return this error message
"https://" not allowed in import path
Solution :
….... read moreGolang : Get currencies exchange rates example
Problem :
You are building an e-commerce website/application and you want to display prices in certain currencies. You need to….... read more
Golang : Get all countries phone codes
Continue from previous tutorial where we learn how to get all the currencies names, but this time it….... read more
Golang : Get all countries currencies code in JSON format
For this tutorial, we will learn how to get all the currencies names from http://country.io/currency.json
and un-marshall them into a….... read more
Golang : Display list of countries and ISO codes
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
Golang : [json: cannot unmarshal object into Go value of type]
Un-marshalling JSON data from external sources can be challenging sometimes. Encountered this error message while working on the previous .... read more
Which content-type(MIME type) to use for JSON data
Problem :
Your program sitting in your web server is pumping out JSON data. You need to set the correct….... read more