diff --git a/gen/decoder.go b/gen/decoder.go index 184b229..f7e415f 100644 --- a/gen/decoder.go +++ b/gen/decoder.go @@ -48,8 +48,8 @@ var primitiveStringDecoders = map[reflect.Kind]string{ reflect.Uint32: "in.Uint32Str()", reflect.Uint64: "in.Uint64Str()", reflect.Uintptr: "in.UintptrStr()", - reflect.Float32: "in.Float32()Str", - reflect.Float64: "in.Float64()Str", + reflect.Float32: "in.Float32Str()", + reflect.Float64: "in.Float64Str()", } var customDecoders = map[string]string{ diff --git a/tests/data.go b/tests/data.go index 5f18a98..f6d6653 100644 --- a/tests/data.go +++ b/tests/data.go @@ -38,8 +38,11 @@ type PrimitiveTypes struct { Uint32String uint32 `json:",string"` Uint64String uint64 `json:",string"` - Float32 float32 `json:",string"` - Float64 float64 `json:",string"` + Float32 float32 + Float64 float64 + + Float32String float32 `json:",string"` + Float64String float64 `json:",string"` Ptr *string PtrNil *string @@ -77,6 +80,9 @@ var primitiveTypesValue = PrimitiveTypes{ Float32: 1.5, Float64: math.MaxFloat64, + Float32String: 1.5, + Float64String: math.MaxFloat64, + Ptr: &str, } @@ -110,6 +116,9 @@ var primitiveTypesString = "{" + `"Float32":` + fmt.Sprint(1.5) + `,` + `"Float64":` + fmt.Sprint(math.MaxFloat64) + `,` + + `"Float32String":"` + fmt.Sprint(1.5) + `",` + + `"Float64String":"` + fmt.Sprint(math.MaxFloat64) + `",` + + `"Ptr":"bla",` + `"PtrNil":null` +