Given the following code:
package main
import (
\"encoding/json\"
\"log\"
)
type Somefin string
func (s *Somefin) UnmarshalJSON(b []byte) error {
I figured this out.
If you have the struct definition like this:
type Wat struct {
A, B string
Somefin
}
Then the error I described in the OP happens. But if you do:
type Wat struct {
A, B string
Somefin Somefin
}
Then it doesn't. Check out Chris's comment to this answer for a good explanation of why.