Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
Allow mockgen to execute from outside go modules
Browse files Browse the repository at this point in the history
  • Loading branch information
linzhp authored and poy committed Sep 30, 2019
1 parent cbd2e35 commit 176c208
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mockgen/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 176c208

Please sign in to comment.