gerrit: switch to use std context package, require Go 1.7+

This ends support for Go 1.6.

Change-Id: If7765a15add556a5a7a881b24b1a38d96ff10841
Reviewed-on: https://go-review.googlesource.com/40938
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/gerrit/demo.go b/gerrit/demo.go
index 9eec921..f7c52fe 100644
--- a/gerrit/demo.go
+++ b/gerrit/demo.go
@@ -8,6 +8,7 @@
 package main
 
 import (
+	"context"
 	"encoding/json"
 	"io/ioutil"
 	"log"
@@ -17,7 +18,6 @@
 	"time"
 
 	"golang.org/x/build/gerrit"
-	"golang.org/x/net/context"
 )
 
 func main() {
diff --git a/gerrit/example_test.go b/gerrit/example_test.go
index 2161c47..ac8faf9 100644
--- a/gerrit/example_test.go
+++ b/gerrit/example_test.go
@@ -5,10 +5,10 @@
 package gerrit_test
 
 import (
+	"context"
 	"fmt"
 
 	"golang.org/x/build/gerrit"
-	"golang.org/x/net/context"
 )
 
 func Example() {
diff --git a/gerrit/gerrit.go b/gerrit/gerrit.go
index 346f30c..b3806fb 100644
--- a/gerrit/gerrit.go
+++ b/gerrit/gerrit.go
@@ -11,6 +11,7 @@
 import (
 	"bufio"
 	"bytes"
+	"context"
 	"encoding/json"
 	"errors"
 	"fmt"
@@ -22,8 +23,6 @@
 	"strconv"
 	"strings"
 	"time"
-
-	"golang.org/x/net/context"
 )
 
 // Client is a Gerrit client.
@@ -133,7 +132,7 @@
 		req.Header.Set("Content-Type", contentType)
 	}
 	c.auth.setAuth(c, req)
-	res, err := c.httpClient().Do(withContext(req, ctx))
+	res, err := c.httpClient().Do(req.WithContext(ctx))
 	if err != nil {
 		return err
 	}
diff --git a/gerrit/gerrit_ctx.go b/gerrit/gerrit_ctx.go
deleted file mode 100644
index 1776fad..0000000
--- a/gerrit/gerrit_ctx.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.7
-
-package gerrit
-
-import (
-	"net/http"
-
-	"golang.org/x/net/context"
-)
-
-func withContext(r *http.Request, ctx context.Context) *http.Request {
-	return r.WithContext(ctx)
-}
diff --git a/gerrit/gerrit_noctx.go b/gerrit/gerrit_noctx.go
deleted file mode 100644
index 529a4a1..0000000
--- a/gerrit/gerrit_noctx.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.7
-
-package gerrit
-
-import (
-	"net/http"
-
-	"golang.org/x/net/context"
-)
-
-func withContext(r *http.Request, ctx context.Context) *http.Request {
-	r.Cancel = ctx.Done()
-	return r
-}
diff --git a/gerrit/gerrit_test.go b/gerrit/gerrit_test.go
index bfee24a..f33f7b7 100644
--- a/gerrit/gerrit_test.go
+++ b/gerrit/gerrit_test.go
@@ -5,13 +5,12 @@
 package gerrit
 
 import (
+	"context"
 	"net/http"
 	"net/http/httptest"
 	"net/url"
 	"testing"
 	"time"
-
-	"golang.org/x/net/context"
 )
 
 // taken from https://go-review.googlesource.com/projects/go