Standard library / testing

testing.B.Skip()

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) Skip(args ...any)

Parameters & Attributes

NameTypeDescription
args...anyValues to format or log.

Working Example

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