I can implement Stringer
to specify how fmt.Print()
will write my custom type as a string. Is there an equivalent for json marshal?
I want to store unique values in go and represent it as a slice in json. Using a slice in go isn't optimal for this. This O(n) insert seems unnecessary - a binary tree or map would be faster, specially since I'm keeping the list sorted at all times.