Switch to go modules
This commit is contained in:
parent
461954facb
commit
1720059244
763 changed files with 24896 additions and 177398 deletions
7
vendor/github.com/go-openapi/swag/json.go
generated
vendored
7
vendor/github.com/go-openapi/swag/json.go
generated
vendored
|
|
@ -68,16 +68,15 @@ func WriteJSON(data interface{}) ([]byte, error) {
|
|||
// ReadJSON reads json data, prefers finding an appropriate interface to short-circuit the unmarshaller
|
||||
// so it takes the fastes option available
|
||||
func ReadJSON(data []byte, value interface{}) error {
|
||||
trimmedData := bytes.Trim(data, "\x00")
|
||||
if d, ok := value.(ejUnmarshaler); ok {
|
||||
jl := &jlexer.Lexer{Data: trimmedData}
|
||||
jl := &jlexer.Lexer{Data: data}
|
||||
d.UnmarshalEasyJSON(jl)
|
||||
return jl.Error()
|
||||
}
|
||||
if d, ok := value.(json.Unmarshaler); ok {
|
||||
return d.UnmarshalJSON(trimmedData)
|
||||
return d.UnmarshalJSON(data)
|
||||
}
|
||||
return json.Unmarshal(trimmedData, value)
|
||||
return json.Unmarshal(data, value)
|
||||
}
|
||||
|
||||
// DynamicJSONToStruct converts an untyped json structure into a struct
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue