Standard library / testing

testing.B.SkipNow()

Mark this scope skipped and stop its calling goroutine. Cleanup still runs; a prior failure is not erased. Expected process exit: 0; output contains ['PASS', 'skipped true']. Run as a _test.go file using the Go test harness.

Formal Syntax & Structure

go syntaxgo
func (c *B) SkipNow()

Working Example

Example Snippetgo
package main
import (  "fmt"  "testing")
func BenchmarkReference(b *testing.B) {  b.Cleanup(func() { fmt.Println("skipped", b.Skipped()) })  b.SkipNow()  fmt.Println("unreachable marker")}
Go Reference