Package documents describe such an example with testing.(*T).Skip:
Tests and control tests may be skipped if they are not applicable when calling the Skip method for * T and * B:
func TestTimeConsuming(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
}
...
}
The message you provided for Skipwill be printed if you run go testwith the flag -v(in this example, you also need to specify a flag -shortto view the skip message).
source
share