Slice conversion requires destination package

This commit is contained in:
Clayton Coleman 2015-12-18 19:04:31 -05:00
parent 977854b8de
commit 173718059d

View File

@ -235,6 +235,8 @@ func (g *conversionGenerator) generateConversionsForMap(inType, outType reflect.
func (g *conversionGenerator) generateConversionsForSlice(inType, outType reflect.Type) error {
inElem := inType.Elem()
outElem := outType.Elem()
// slice conversion requires the package for the destination type in order to instantiate the map
g.addImportByPath(outElem.PkgPath())
if err := g.generateConversionsBetween(inElem, outElem); err != nil {
return err
}