Skip to content

Commit

Permalink
Merge pull request #88 from ebfe/testimport
Browse files Browse the repository at this point in the history
Remove unnecessary import in generated tests when -io=false
  • Loading branch information
philhofer committed Jun 6, 2015
2 parents e5589c2 + bb1c0bf commit b0fa7d5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion printer/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ func generate(file string, f *parse.FileSet, mode gen.Method) error {
if err != nil {
return err
}
err = writeImportHeader(testwr, "bytes", "github.com/tinylib/msgp/msgp", "testing")
if mode&(gen.Encode|gen.Decode) != 0 {
err = writeImportHeader(testwr, "bytes", "github.com/tinylib/msgp/msgp", "testing")
} else {
err = writeImportHeader(testwr, "github.com/tinylib/msgp/msgp", "testing")
}
}
return f.PrintTo(gen.NewPrinter(mode, outwr, testwr))
}
Expand Down

0 comments on commit b0fa7d5

Please sign in to comment.