Nope, that's not it :'(. Here's a better way to explain: main.go // (unexported) type database?? interface { // how do I name this? query() (result, error) }
// (unexported) type database?? struct {} // how do I name this? func (d database??) query() (result, error) { ... } test.go // (unexported) type mockDatabase struct {} // this name makes sense to me func (d database??) query() (result, error) { ... } If I've known it was gonna be this hard to get my point across, I would have done this from the start; I'm terribly sorry for wasting so much of your time. On Sunday, 5 March 2017 15:30:17 UTC+13, Henry wrote: > > Let's see if I understand your question correctly. You have the interface > in your main code, and the implementing struct in your test code. Do I get > that right? > > Another question is whether the main code and the test code live in the > same package or different package. I normally put my test code in a > separate package. So if my main code is in package abc, then my test code > would be in abc_test. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.