See TestMain() documentation in "Overview" for 
https://golang.org/pkg/testing/

On Tuesday, January 17, 2017 at 12:28:34 AM UTC-7, alcub...@gmail.com wrote:
>
> I'm trying to test my packages without bloating the size of the binary. 
> Currently this consists of moving the test code into a test/ subdirectory. 
> If there's a better way to handle this, e.g. tree-shaking, please let me 
> know.
>
> Unfortunately, I have a package that needs to be initialized before use 
> (mainly connecting to a DB). For testing purposes, I have a mock 
> initialization routine. However, that initialization routine needs to 
> modify private variables, so I can't move it into test/. Is there any way 
> around this that avoids including the mock code in my production binary?
>
> Sincerely,
>
> Alex Becker
>

-- 
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.

Reply via email to