Standard library / testing

testing.Cover

Historical coverage accumulator descriptor for generated testing infrastructure. Not a supported stable user API; use go test -cover instead. Expected stdout: 'set 1\n'.

Formal Syntax & Structure

go syntaxgo
type Cover struct {  Mode            string  Counters        map[string][]uint32  Blocks          map[string][]CoverBlock  CoveredPackages string}

Working Example

Example Snippetgo
package main
import (  "fmt"  "testing")
func main() {  c := testing.Cover{Mode: "set", Counters: map[string][]uint32{"demo.go": {1}}}  fmt.Println(c.Mode, len(c.Counters))}
Go Reference