Standard library / testing
testing.CoverMode()
Return the coverage mode, or an empty string when coverage is disabled. Expected stdout: 'true\nPASS\n'. Run as a _test.go file using the Go test harness.
Formal Syntax & Structure
go syntaxgo
func CoverMode() stringReturn Value
string
Result of the operation described above.
Working Example
Example Snippetgo
package main
import ( "fmt" "testing")
func TestReference(t *testing.T) { fmt.Println(testing.CoverMode() == "") }