dcrjson: Address some linter complaints.

This commit is contained in:
Dave Collins 2022-04-17 23:49:17 -05:00
parent ca0e41269f
commit 4716224ece
No known key found for this signature in database
GPG Key ID: B8904D9D9C93D1F2
3 changed files with 13 additions and 1 deletions

View File

@ -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,

View File

@ -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{})

View File

@ -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)
},