Merge pull request #17 from ceh/fix-format-errors
decoder: fix format error due to invalid argument (byte to string)
This commit is contained in:
commit
96d5b40433
13
decoder.go
13
decoder.go
@ -96,7 +96,7 @@ func (d *decoder) decodeBool(name string, o *hcl.Object, result reflect.Value) e
|
||||
case hcl.ValueTypeBool:
|
||||
result.Set(reflect.ValueOf(o.Value.(bool)))
|
||||
default:
|
||||
return fmt.Errorf("%s: unknown type %s", name, o.Type)
|
||||
return fmt.Errorf("%s: unknown type %v", name, o.Type)
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -107,7 +107,7 @@ func (d *decoder) decodeFloat(name string, o *hcl.Object, result reflect.Value)
|
||||
case hcl.ValueTypeFloat:
|
||||
result.Set(reflect.ValueOf(o.Value.(float64)))
|
||||
default:
|
||||
return fmt.Errorf("%s: unknown type %s", name, o.Type)
|
||||
return fmt.Errorf("%s: unknown type %v", name, o.Type)
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -125,7 +125,7 @@ func (d *decoder) decodeInt(name string, o *hcl.Object, result reflect.Value) er
|
||||
|
||||
result.SetInt(int64(v))
|
||||
default:
|
||||
return fmt.Errorf("%s: unknown type %s", name, o.Type)
|
||||
return fmt.Errorf("%s: unknown type %v", name, o.Type)
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -196,7 +196,7 @@ func (d *decoder) decodeInterface(name string, o *hcl.Object, result reflect.Val
|
||||
|
||||
func (d *decoder) decodeMap(name string, o *hcl.Object, result reflect.Value) error {
|
||||
if o.Type != hcl.ValueTypeObject {
|
||||
return fmt.Errorf("%s: not an object type for map (%s)", name, o.Type)
|
||||
return fmt.Errorf("%s: not an object type for map (%v)", name, o.Type)
|
||||
}
|
||||
|
||||
// If we have an interface, then we can address the interface,
|
||||
@ -324,7 +324,7 @@ func (d *decoder) decodeString(name string, o *hcl.Object, result reflect.Value)
|
||||
case hcl.ValueTypeString:
|
||||
result.Set(reflect.ValueOf(o.Value.(string)).Convert(result.Type()))
|
||||
default:
|
||||
return fmt.Errorf("%s: unknown type to string: %s", name, o.Type)
|
||||
return fmt.Errorf("%s: unknown type to string: %v", name, o.Type)
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -332,8 +332,7 @@ func (d *decoder) decodeString(name string, o *hcl.Object, result reflect.Value)
|
||||
|
||||
func (d *decoder) decodeStruct(name string, o *hcl.Object, result reflect.Value) error {
|
||||
if o.Type != hcl.ValueTypeObject {
|
||||
return fmt.Errorf(
|
||||
"%s: not an object type for struct (%s)", name, o.Type)
|
||||
return fmt.Errorf("%s: not an object type for struct (%v)", name, o.Type)
|
||||
}
|
||||
|
||||
// This slice will keep track of all the structs we'll be decoding.
|
||||
|
Loading…
Reference in New Issue
Block a user