Ikai Lan says

I say things!

Archive for November 2nd, 2017

Is go test running slowly with your sqlite3 tests?

I have to look this up every time I clean up my environment, so I’ll write a quick post about it.

I love go test. It runs fast … except when it doesn’t. I noticed after adding a sqlite3 dependency for unit testing that it started to take 30 seconds to run.

Digging into it, I found this link to a discussion on golang-nuts. Basically: the root cause is that it was compiling the 5mb .c file each time.

The suggestion is to use go install on the sqlite3 dependency. If this works for you, great. It didn’t seem to work for me – possibly because I’m using vendoring and govend? I’m not sure. I didn’t spend too much time digging into it.

The magic command for me was this:

go test -i -v

That installed the dependencies, which made subsequent runs of go test much faster.


Written by Ikai Lan

November 2, 2017 at 2:57 pm