The simplest way to print an array or even interface in Golang is to write the below function.

func PrettyPrint(i interface{}) string {
s, _ := json.MarshalIndent(i, "", "\t")
fmt.Println(string(s))
return string(s)
}

Also we can define as struct in GO.

package prettyprintimport (
"encoding/json"
"fmt")var (

--

--