Skip to content

Commit

Permalink
add the working directory to context for build.Import call
Browse files Browse the repository at this point in the history
  • Loading branch information
joefitzgerald committed May 8, 2020
1 parent 056b3fa commit dfb29fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ _testmain.go
integration/testdata/output
*.profile
*.bench
/.vscode
4 changes: 3 additions & 1 deletion generator/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ func (f *Fake) loadPackages(c Cacher, workingDir string) error {
}
importPath := f.TargetPackage
if !filepath.IsAbs(importPath) {
bp, err := build.Import(f.TargetPackage, workingDir, build.FindOnly)
ctx := build.Default
ctx.Dir = workingDir
bp, err := ctx.Import(f.TargetPackage, workingDir, build.FindOnly)
if err != nil {
return err
}
Expand Down

0 comments on commit dfb29fe

Please sign in to comment.