I'm running a very simple test adding two numbers.
package internal
import "testing"
func TestAddingNumbers(t *testing.T) {
if add(1, 5) != 6 {
t.Errorf("Failed Adding numbers")
}
}
First
go test -v file.go file_test.go
runs in => ok command-line-arguments 0.434s
While second in
go test -v file.go file_test.go
runs in => ok command-line-arguments 0.099s
Is there a way to make first test faster? My understanding is that there is some caching happening so the second is faster. But in the context of CI step, cache won't be there and it will makes things slow.