Timeout Duration Setting in Go Test
In a typical Go test workflow, users may encounter an error when setting the timeout flag using a simple numeric value:
go test -timeout 99999
This command will result in the following error:
invalid value "99999" for flag -test.timeout: time: missing unit in duration 99999
Solution: Using Valid Duration Format
To rectify this issue, users should utilize a valid time format as specified by time.ParseDuration. Valid formats include:
Examples:
$ go test -timeout 300ms $ go test -timeout 99999s
Reference:
The above is the detailed content of How to Correctly Set Timeout Duration in Go Test?. For more information, please follow other related articles on the PHP Chinese website!