Skip to content
masterclass Buddy

Go · Command

go test

Go tests live in _test.go files and use functions named TestName with a *testing.T parameter. Run them with go test; report failures with methods such as t.Errorf.

Last updated

Syntax

func TestName(t *testing.T)
go test

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • testing
  • testing.T
  • t.Errorf
  • go test
  • -run
  • -v
  • _test.go

Source: Add a test - The Go Programming Language. Checked 2026-11-03.