[tor-commits] [snowflake/master] Use the "context" package in go 1.7

arlo at torproject.org arlo at torproject.org
Thu Oct 12 22:39:58 UTC 2017


commit 82d7f16babcdacdd120465fdd80b3468ea03246c
Author: Arlo Breault <arlolra at gmail.com>
Date:   Thu Oct 12 18:39:03 2017 -0400

    Use the "context" package in go 1.7
    
     * Since we're now assuming >= 1.8.3
---
 appengine/reflect.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/appengine/reflect.go b/appengine/reflect.go
index f5aa3c8..24f4d95 100644
--- a/appengine/reflect.go
+++ b/appengine/reflect.go
@@ -3,12 +3,12 @@
 package reflect
 
 import (
+	"context"
 	"io"
 	"net/http"
 	"net/url"
 	"time"
 
-	"golang.org/x/net/context"
 	"google.golang.org/appengine"
 	"google.golang.org/appengine/log"
 	"google.golang.org/appengine/urlfetch"
@@ -75,7 +75,9 @@ func handler(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 	if urlFetchTimeout != 0 {
-		context_, _ = context.WithTimeout(context_, urlFetchTimeout)
+		var cancel context.CancelFunc
+		context_, cancel = context.WithTimeout(context_, urlFetchTimeout)
+		defer cancel()
 	}
 	// Use urlfetch.Transport directly instead of urlfetch.Client because we
 	// want only a single HTTP transaction, not following redirects.



More information about the tor-commits mailing list