I have the following tree structure of files:
-app/
---tool/
-----/tool_test.go
-----/tool.go
-----/proto/proto.go
-----/proto/proto_test.go
I need to use a (dummy) struct implementing an interface in both tool_test.go
and proto_test.go
:
type DummyRetriever struct{}
func (dummy *DummyRetriever) Retrieve(name string) (string, error) {
return "", nil
}
If I define it in tool_test.go
only, I can't see and use it in proto_test.go
, as _test.go files don't export names.
Where do I define the DummyRetriever
so that it is available in both packages?
I want to avoid having it to define in a file so that the name is then also visible in core (non-test) packages.