Standard library / testing
testing.Coverage()
Return the fraction of instrumented statements covered so far, zero without coverage instrumentation. Expected stdout: '0\nPASS\n'. Run as a _test.go file using the Go test harness.
Formal Syntax & Structure
go syntaxgo
func Coverage() float64Return Value
float64
Result of the operation described above.
Working Example
Example Snippetgo
package main
import ( "fmt" "testing")
func TestReference(t *testing.T) { fmt.Println(testing.Coverage()) }