[Go] Show output from passing tests with go test -v

Created on November 30, 2026

When you pass a package to go test, such as go test ., Go normally hides output from passing tests. Add -v to show it, including messages written with fmt.Println.

In a Go module, save this example as hello_test.go.

package hello

import (
    "fmt"
    "testing"
)

func TestHello(t *testing.T) {
    fmt.Println("Hello from the test")
}
go test -v .

The output includes these lines.

=== RUN   TestHello
Hello from the test
--- PASS: TestHello (0.00s)
Go