Use pointers to make generic functions work
This commit is contained in:
@@ -19,13 +19,13 @@ func newCommonAttributes() *CommonAttributes {
|
||||
|
||||
// AddAttribute adds the attribute to the CommonAttributes.
|
||||
func (c *CommonAttributes) AddAttribute(name, value string) {
|
||||
addToSlice(c.UndefinedAttributes, &xml.Attr{Name: xml.Name{Local: name}, Value: value})
|
||||
addToSlice(&c.UndefinedAttributes, &xml.Attr{Name: xml.Name{Local: name}, Value: value})
|
||||
}
|
||||
|
||||
// DeleteAttribute deletes the attribute from the CommonAttributes. It return an
|
||||
// error.
|
||||
func (c *CommonAttributes) DeleteAttribute(id int) error {
|
||||
if err := deleteFromSlice(c.UndefinedAttributes, id); err != nil {
|
||||
if err := deleteFromSlice(&c.UndefinedAttributes, id); err != nil {
|
||||
return fmt.Errorf("error deleting undefined attribute %v from common attributes %v: %v", id, c, err)
|
||||
}
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user