diff --git a/dcrjson/cmdparse.go b/dcrjson/cmdparse.go index a583d5c0..a10f8493 100644 --- a/dcrjson/cmdparse.go +++ b/dcrjson/cmdparse.go @@ -447,7 +447,7 @@ func assignField(paramNum int, fieldName string, dest reflect.Value, src reflect // String -> float of varying size. case reflect.Float32, reflect.Float64: - srcFloat, err := strconv.ParseFloat(src.String(), 0) + srcFloat, err := strconv.ParseFloat(src.String(), 64) if err != nil { str := fmt.Sprintf("parameter #%d '%s' must "+ "parse to a %v", paramNum, fieldName, diff --git a/dcrjson/help_test.go b/dcrjson/help_test.go index 97035a12..c8a41848 100644 --- a/dcrjson/help_test.go +++ b/dcrjson/help_test.go @@ -172,6 +172,7 @@ func TestHelpReflectInternals(t *testing.T) { name: "array of struct indent level 0", reflectType: func() reflect.Type { type s struct { + // nolint: structcheck, unused field int } return reflect.TypeOf([]s{}) @@ -191,6 +192,7 @@ func TestHelpReflectInternals(t *testing.T) { name: "array of struct indent level 1", reflectType: func() reflect.Type { type s struct { + // nolint: structcheck, unused field int } return reflect.TypeOf([]s{}) @@ -308,6 +310,7 @@ func TestResultStructHelp(t *testing.T) { name: "struct with primitive field", reflectType: func() reflect.Type { type s struct { + // nolint: structcheck, unused field int } return reflect.TypeOf(s{}) @@ -332,6 +335,7 @@ func TestResultStructHelp(t *testing.T) { name: "struct with array of primitive field", reflectType: func() reflect.Type { type s struct { + // nolint: structcheck, unused field []int } return reflect.TypeOf(s{}) @@ -343,10 +347,12 @@ func TestResultStructHelp(t *testing.T) { { name: "struct with sub-struct field", reflectType: func() reflect.Type { + // nolint: structcheck, unused type s2 struct { subField int } type s struct { + // nolint: structcheck, unused field s2 } return reflect.TypeOf(s{}) @@ -361,10 +367,12 @@ func TestResultStructHelp(t *testing.T) { { name: "struct with sub-struct field pointer", reflectType: func() reflect.Type { + // nolint: structcheck, unused type s2 struct { subField int } type s struct { + // nolint: structcheck, unused field *s2 } return reflect.TypeOf(s{}) @@ -379,10 +387,12 @@ func TestResultStructHelp(t *testing.T) { { name: "struct with array of structs field", reflectType: func() reflect.Type { + // nolint: structcheck, unused type s2 struct { subField int } type s struct { + // nolint: structcheck, unused field []s2 } return reflect.TypeOf(s{}) diff --git a/dcrjson/register_test.go b/dcrjson/register_test.go index 4a7db7d6..ff4e5218 100644 --- a/dcrjson/register_test.go +++ b/dcrjson/register_test.go @@ -122,6 +122,7 @@ func TestRegisterCmdErrors(t *testing.T) { name: "embedded field", method: "registertestcmd", cmdFunc: func() interface{} { + // nolint: unused type test struct{ int } return (*test)(nil) }, @@ -131,6 +132,7 @@ func TestRegisterCmdErrors(t *testing.T) { name: "unexported field", method: "registertestcmd", cmdFunc: func() interface{} { + // nolint: structcheck, unused type test struct{ a int } return (*test)(nil) },