diff --git a/mockgen/parse.go b/mockgen/parse.go index 9c5475e9..d25e3ce5 100644 --- a/mockgen/parse.go +++ b/mockgen/parse.go @@ -47,7 +47,7 @@ func parseFile(source string) (*model.Package, error) { return nil, fmt.Errorf("failed getting source directory: %v", err) } - cfg := &packages.Config{Mode: packages.LoadSyntax, Tests: true} + cfg := &packages.Config{Mode: packages.LoadFiles, Tests: true, Dir: srcDir} pkgs, err := packages.Load(cfg, "file="+source) if err != nil { return nil, err