5 // StrSlice represents a string or an array of strings.
6 // We need to override the json decoder to accept both options.
9 // UnmarshalJSON decodes the byte slice whether it's a string or an array of
10 // strings. This method is needed to implement json.Unmarshaler.
11 func (e *StrSlice) UnmarshalJSON(b []byte) error {
13 // With no input, we preserve the existing value by returning nil and
14 // leaving the target alone. This allows defining default values for
19 p := make([]string, 0, 1)
20 if err := json.Unmarshal(b, &p); err != nil {
22 if err := json.Unmarshal(b, &s); err != nil {