qur / withmock

Automatic Go package mock generation tool
Other
71 stars 9 forks source link

Build tags ignored when compiling mocks #42

Open mmellar opened 9 years ago

mmellar commented 9 years ago

Say I'm trying to mock a package which uses build flags...

(file: mypackage.go) package mypackage

func foo(){ bar() }

(file: mypackagev1.go) // +build v1 package mypackage

func bar(){ fmt.println("using v1") }

(file: mypackagev2.go) // +build v2 package mypackage

func bar(){ fmt.println("using v2") }

We see compilation errors when trying to run tests using withmock. It looks like neither of the conditional files are being included which causes the compiler to complain about function 'bar' being missing.