Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

no obvious way to disable test caching in go 1.10 [duplicate]

Tags:

caching

go

Golang 1.10 introduced caching for test, but there is no obvious way to disable test caching. So the question is, how to temporal dislable it and how to force rebuild it. I did read the documentation: https://golang.org/cmd/go/#hdr-Build_and_test_caching but did not found any obvious answer to that question.

like image 360
Macilias Avatar asked Apr 24 '18 10:04

Macilias


1 Answers

The idiomatic way to bypass test caching is to use -count=1. This is the recommended way for doing that in release note as well

The go test command now caches test results: if the test executable and command line match a previous run and the files and environment variables consulted by that run have not changed either, go test will print the previous test output, replacing the elapsed time with the string “(cached).” Test caching applies only to successful test results; only to go test commands with an explicit list of packages; and only to command lines using a subset of the -cpu, -list, -parallel, -run, -short, and -v test flags. The idiomatic way to bypass test caching is to use -count=1.

Refer : https://golang.org/doc/go1.10#test

like image 108
Sarath Sadasivan Pillai Avatar answered Nov 14 '22 03:11

Sarath Sadasivan Pillai