package types import ( "bytes" "fmt" ) type ( // Zone represents the name of a zone. A zone must end with a `.`. Zone string ) func (z *Zone) UnmarshalJSON(in []byte) error { in = bytes.Trim(in, `"`) if in[len(in)-1] != '.' { return fmt.Errorf("not a valid zone name") } *z = Zone(in) return nil }