Documentation ¶
Overview ¶
Package metautil takes care of basic details of working with snap metadata formats.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeValue ¶
func NormalizeValue(v interface{}) (interface{}, error)
NormalizeValue validates values and returns a normalized version of it (map[interface{}]interface{} is turned into map[string]interface{})
func SetValueFromAttribute ¶
func SetValueFromAttribute(snapName string, ifaceName string, attrName string, attrVal interface{}, val interface{}) error
SetValueFromAttribute attempts to convert the attribute value read from the given snap/interface into the desired type.
The snapName, ifaceName and attrName are only used to produce contextual error messages, but are not otherwise significant. This function only operates converting the attrVal parameter into a value which can fit into the val parameter, which therefore must be a pointer.
Types ¶
type AttributeNotCompatibleError ¶
type AttributeNotCompatibleError struct { SnapName string InterfaceName string AttributeName string AttributeType reflect.Type ExpectedType reflect.Type }
AttributeNotCompatibleError represents a type mismatch error between an interface attribute and an expected type.
func (AttributeNotCompatibleError) Error ¶
func (e AttributeNotCompatibleError) Error() string
func (AttributeNotCompatibleError) Is ¶
func (e AttributeNotCompatibleError) Is(target error) bool