diff options
Diffstat (limited to 'compileopts/target.go')
-rw-r--r-- | compileopts/target.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/compileopts/target.go b/compileopts/target.go index 15bfaf781..aa2c432d4 100644 --- a/compileopts/target.go +++ b/compileopts/target.go @@ -88,8 +88,17 @@ func (spec *TargetSpec) overrideProperties(child *TargetSpec) { if !src.IsNil() { dst.Set(src) } - case reflect.Slice: // for slices, append the field + case reflect.Slice: // for slices, append the field and check for duplicates dst.Set(reflect.AppendSlice(dst, src)) + for i := 0; i < dst.Len(); i++ { + v := dst.Index(i).String() + for j := i + 1; j < dst.Len(); j++ { + w := dst.Index(j).String() + if v == w { + panic("duplicate value '" + v + "' in field : " + field.Name) + } + } + } default: panic("unknown field type : " + kind.String()) } |