Within the instance, we create an HTTP shopper with a timeout of 1 nanosecond. With such a brief timeout, we are able to make sure that we’ll obtain a timeout error after we ship a request to the
2022/08/28 18:35:48 timeout error: Get "https://instance.com": context deadline exceeded (Shopper.Timeout exceeded whereas awaiting headers)
Learn this text to be taught extra concerning the
context deadline exceeded, which can also be a timeout error.
To be sure that
os.IsTimeout() works accurately, change the timeout worth in line
1 * time.Minute. If there may be at present no drawback with
https://instance.com, the request will probably be processed throughout the time restrict of 1 minute and you’ll not see any error on the output.