How to set the go timeout flag on “Go test”

Use a valid time.ParseDuration input. For example,

$ go test -timeout 300ms

$ go test -timeout 99999s

Command go

Testing flags

-timeout t

If a test runs longer than t, panic.

Package flag

Duration flags accept any input valid for time.ParseDuration.

Package time

func ParseDuration

func ParseDuration(s string) (Duration, error)

ParseDuration parses a duration string. A duration string is a
possibly signed sequence of decimal numbers, each with optional
fraction and a unit suffix, such as “300ms“, “-1.5h” or “2h45m“. Valid
time units are “ns“, “us” (or “µs“), “ms“, “s“, “m“, “h“.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)