14 Commits

Author SHA1 Message Date
Dmitri Shuralyov
918d64e8e6 context: delete dead code, sync docs with upstream context package
The go directive is now at 1.23.0, so the go1.7 and go1.9 build
constraints are guaranteed to always be satisfied, and their inverse
will never be satisfied. Delete all the dead code and merge everything
that's left in a single context.go file. Also update docs to match the
upstream context package.

For golang/go#49506.

Change-Id: I317550767838a93af2c2d3dbc7b61f2e37e6fe1c
Reviewed-on: https://go-review.googlesource.com/c/net/+/650155
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-02-18 09:28:57 -08:00
Damien Neil
c1f5833288 all: replace deprecated io/ioutil calls
The io/ioutil package's features were moved to
the io and os packages in Go 1.16.

x/net depends on Go 1.18. Drop ioutil calls,
so gopls doesn't warn about them.

Change-Id: Ibdb576d94f250808ae285aa142e2fd41e7e9afc9
Reviewed-on: https://go-review.googlesource.com/c/net/+/586244
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-21 19:59:00 +00:00
Dmitri Shuralyov
d23d9bc549 all: update go directive to 1.18
Done with:

go get go@1.18
go mod tidy
go fix ./...

Using go1.21.3.

With a manual change to keep golang.org/x/net/context testing itself,
not context in the standard library.

For golang/go#60268.

Change-Id: I00682bf7cf1e3ba4370e2a3e7f63dc245b294a36
Reviewed-on: https://go-review.googlesource.com/c/net/+/534241
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2023-10-11 21:58:12 +00:00
Russ Cox
5f55cee0dc all: go fmt ./...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).

Not strictly necessary but will avoid spurious changes
as files are edited.

Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild

Change-Id: I5b2b7d93424e828a3c5f76ae3f30ab825aca388e
Reviewed-on: https://go-review.googlesource.com/c/net/+/294371
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-20 03:31:24 +00:00
Dmitri Shuralyov
88d92db4c5 context/ctxhttp: remove Go 1.6 support, use std context
Fixes golang/go#21358

Change-Id: I8f8653df3c1e3c86cc8515a78509a8af03160944
Reviewed-on: https://go-review.googlesource.com/c/149277
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-13 16:55:02 +00:00
haya14busa
349ad30abd context/ctxhttp: close httptest server
Change-Id: Ic8192f74337e021a5d72feb07b9648619d778235
Reviewed-on: https://go-review.googlesource.com/36673
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-09 17:05:06 +00:00
Ian Lance Taylor
45b61eaf18 context/ctxhttp: if context is canceled, return its error
This preserves the promise that Do will return the context's error.

Fixes golang/go#16381

Change-Id: I0db49b175736a695199b38819b4ff97b83d9c5ed
Reviewed-on: https://go-review.googlesource.com/24977
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-16 21:44:27 +00:00
Brad Fitzpatrick
f841c39de7 context/ctxhttp: add a specialized minimal version for Go 1.7
Change-Id: Ib174b984184191d803364c684070346a105ef4b5
Reviewed-on: https://go-review.googlesource.com/24620
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Day <djd@golang.org>
2016-07-07 22:37:29 +00:00
Dave Day
815d315ead context/ctxhttp: remove pre-Go 1.5 support
The Go 1.4 (and earlier) support for request cancellation is racy and
complicates the implementation of ctxhttp. This change simply inlines
the existing 1.5+ cancellation logic directly, and removes support for
older versions.

Change-Id: I7df9f0648dd0e571366374d079e2976050464ca3
Reviewed-on: https://go-review.googlesource.com/22302
Reviewed-by: David Symonds <dsymonds@golang.org>
Run-TryBot: David Symonds <dsymonds@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-21 00:36:51 +00:00
Brad Fitzpatrick
a4bbce9fca context/ctxhttp: fix data race in tests
Change-Id: If36de4de2c4fac6767aa5490e6f3d8c15531dda6
Reviewed-on: https://go-review.googlesource.com/20275
Reviewed-by: Dave Day <djd@golang.org>
2016-03-06 22:39:36 +00:00
Brad Fitzpatrick
f315505cf3 net/context/ctxhttp: fix case where Body could leak and not be closed
Fixes golang/go#14065

Change-Id: Ic19a0f740cddced8fb782f65cea14da383b047b1
Reviewed-on: https://go-review.googlesource.com/18802
Reviewed-by: Olivier Poitrey <rs@rhapsodyk.net>
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-26 03:35:23 +00:00
Brad Fitzpatrick
e82aa266f2 context/ctxhttp: don't test on plan9
plan9's network deadline & cancelation code is so brittle that it's
not even worth testing this package there. It only results in 10
minute deadlocks and slows down the trybots which should be ~30
seconds, not 10 minutes.

Change-Id: I097a885ae5887f0ecf357611aa7fae8885e18e05
Reviewed-on: https://go-review.googlesource.com/18578
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-01-13 22:11:00 +00:00
Dave Day
3b90a77d28 context/ctxhttp: allow cancellation after Do returns
Fixes #13325.

Change-Id: I17f35232cd0ea43e50ea12db09272195789426e9
Reviewed-on: https://go-review.googlesource.com/18188
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-05 05:09:10 +00:00
Chris Broadfoot
1bc0720082 context: Add ctxhttp package.
ctxhttp provides helper functions for performing context-aware HTTP
requests.

Fixes golang/go#11904

Change-Id: Ib9d2fef48953dbb52f0a70e1ed49ea7fe12b7801
Reviewed-on: https://go-review.googlesource.com/12755
Reviewed-by: David Symonds <dsymonds@golang.org>
Reviewed-by: Aaron Jacobs <jacobsa@google.com>
Reviewed-by: Dave Day <djd@golang.org>
2015-08-05 04:30:13 +00:00