From 58839cefb50e56ae5b157b37e9814ae83ceee70b Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Thu, 20 Jul 2017 15:22:49 -0700 Subject: Upgrading server dependancies (#6984) --- vendor/golang.org/x/net/context/withtimeout_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'vendor/golang.org/x/net/context/withtimeout_test.go') diff --git a/vendor/golang.org/x/net/context/withtimeout_test.go b/vendor/golang.org/x/net/context/withtimeout_test.go index a6754dc36..e6f56691d 100644 --- a/vendor/golang.org/x/net/context/withtimeout_test.go +++ b/vendor/golang.org/x/net/context/withtimeout_test.go @@ -11,16 +11,21 @@ import ( "golang.org/x/net/context" ) +// This example passes a context with a timeout to tell a blocking function that +// it should abandon its work after the timeout elapses. func ExampleWithTimeout() { // Pass a context with a timeout to tell a blocking function that it // should abandon its work after the timeout elapses. - ctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond) + ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond) + defer cancel() + select { - case <-time.After(200 * time.Millisecond): + case <-time.After(1 * time.Second): fmt.Println("overslept") case <-ctx.Done(): fmt.Println(ctx.Err()) // prints "context deadline exceeded" } + // Output: // context deadline exceeded } -- cgit v1.2.3-1-g7c22