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