1# Embedded Interfaces in aux_files 2 3Embedded interfaces in `aux_files` generate `unknown embedded interface XXX` errors. 4See below for example of the problem: 5 6```go 7// source 8import ( 9 alias "some.org/package/imported" 10) 11 12type Source interface { 13 alias.Foreign 14} 15``` 16 17```go 18// some.org/package/imported 19type Foreign interface { 20 Embedded 21} 22 23type Embedded interface {} 24``` 25 26Attempting to generate a mock will result in an `unknown embedded interface Embedded`. 27The issue is that the `fileParser` stores `auxInterfaces` underneath the package name 28explicitly specified in the `aux_files` flag. 29 30In the `parseInterface` method, there is an incorrect assumption about an embedded interface 31always being in the source file. 32 33```go 34case *ast.Ident: 35 // Embedded interface in this package. 36 ei := p.auxInterfaces[""][v.String()] 37 if ei == nil { 38 return nil, p.errorf(v.Pos(), "unknown embedded interface %s", v.String()) 39 } 40``` 41