Hi!
I'm not a guru, but since nobody else responded, I thought I might give you my thoughts.
Overall it looks very good, I don't know HAL links into details, but your implementation seem nice.
First, name your package "hal". Other people using it will have to use "gohal", which isn't really needed to know what they are dealing with.
I would personally either:
a) call "Encode" function something a bit more descriptive, like EncodeHal, or
b) make a
type Hal ap[string]interface{}, so the interface has to return a specific type, that way you don't get accidental clashes, and you are type safe.I implemented "b)":
https://github.com/klauspost/gohal/tree/master - Notice how much cleaner things become with that simple change.
I am still not really sure how this is intended to be used. It seems quite a bit bothersome to have to implement "Encode" for all my types. I would think the best way would be to use an anonymous field in my struct, so I can use the standard JSON encoding functions in golang. I will try to see if I can give you an example, since it isn't that trivial.
/Klaus