This check detects the code
resp, err := http.Get("http://foo.com")
defer resp.Body.Close()
if err != nil {
...
}
For every call to a function on the net/http package or any method
on http.Client that returns (*http.Response, error), it checks
whether the next line is a defer statement that calls on the response.
Fixes#17780.
Change-Id: I9d70edcbfa2bad205bf7f45281597d074c795977
Reviewed-on: https://go-review.googlesource.com/32911
Reviewed-by: Rob Pike <r@golang.org>
Add Albert Nigmatzianov (individual CLA)
Add Alex Browne (individual CLA)
Add Alex Carol (individual CLA)
Add Alexander Döring (individual CLA)
Add Allan Simon (individual CLA)
Add Alok Menghrajani (individual CLA)
Add Andreas Auernhammer (individual CLA)
Add Andreas Litt (individual CLA)
Add Andrew Pogrebnoy (individual CLA)
Add Antonio Murdaca (corporate CLA for Red Hat, Inc.)
Add Atin Malaviya (individual CLA)
Add Billy Lynch (corporate CLA for Google Inc.)
Add Blixt (individual CLA)
Add Boris Nagaev (corporate CLA for Google Inc.)
Add Braden Bassingthwaite (corporate CLA for Vendasta)
Add Brian Kennedy (individual CLA)
Add Bryan Alexander (individual CLA)
Add Carl Johnson (individual CLA)
Add Cixtor (individual CLA)
Add Cyrill Schumacher (individual CLA)
Add Daniel Martí (individual CLA)
Add Daria Kolistratova (corporate CLA for Intel Corporation)
Add David Hubbard (corporate CLA for Google Inc.)
Add David Stainton (individual CLA)
Add Deepak Jois (individual CLA)
Add Denis Nagorny (corporate CLA for Intel Corporation)
Add Dhaivat Pandit (individual CLA)
Add Dhananjay Nakrani (corporate CLA for Google Inc.)
Add Dmitri Popov (individual CLA)
Add Erik Staab (corporate CLA for Google Inc.)
Add Ethan Miller (corporate CLA for IBM)
Add Faiyaz Ahmed (individual CLA)
Add Fedor Indutny (individual CLA)
Add Gabriel Russell (individual CLA)
Add Gareth Paul Jones (individual CLA)
Add Geoffroy Lorieux (individual CLA)
Add Gleb Stepanov (individual CLA)
Add Henrik Hodne (individual CLA)
Add Ivan Babrou (individual CLA)
Add Jack Lindamood (corporate CLA for Amazon.com, Inc)
Add James Clarke (individual CLA)
Add Jamie Beverly (individual CLA)
Add Jason Smale (individual CLA)
Add Jean-Nicolas Moal (individual CLA)
Add Jeroen Bobbeldijk (individual CLA)
Add Jim Kingdon (corporate CLA for Bolt)
Add Jirka Daněk (individual CLA)
Add Jon Chen (corporate CLA for Amazon.com, Inc)
Add Joonas Kuorilehto (individual CLA)
Add Josh Chorlton (individual CLA)
Add Joshua Boelter (corporate CLA for Intel Corporation)
Add Justyn Temme (individual CLA)
Add Kale Blankenship (individual CLA)
Add LE Manh Cuong (individual CLA)
Add Luigi Riefolo (individual CLA)
Add Manfred Touron (individual CLA)
Add Martin Bertschler (individual CLA)
Add Martin Hamrle (individual CLA)
Add Matthew Denton (individual CLA)
Add Matthieu Hauglustaine (individual CLA)
Add Michael Darakananda (corporate CLA for Google Inc.)
Add Mike Appleby (individual CLA)
Add Mike Houston (individual CLA)
Add Mike Strosaker (corporate CLA for IBM)
Add Miroslav Genov (individual CLA)
Add Momchil Velikov (individual CLA)
Add Nick Harper (corporate CLA for Google Inc.)
Add Oleg Vakheta (individual CLA)
Add Parker Moore (individual CLA)
Add Prasanna Swaminathan (corporate CLA for MediaMath, Inc)
Add Radu Berinde (individual CLA)
Add Ramesh Dharan (corporate CLA for Google Inc.)
Add Richard Gibson (individual CLA)
Add Samuel Tan (corporate CLA for Google Inc.)
Add Samuele Pedroni (individual CLA)
Add Sarah Adams (corporate CLA for Google Inc.)
Add Sean Rees (individual CLA)
Add Simon Rawet (individual CLA)
Add Sina Siadat (individual CLA)
Add Song Gao (individual CLA)
Add Suyash (individual CLA)
Add Sven Blumenstein (corporate CLA for Google Inc.)
Add Syohei YOSHIDA (individual CLA)
Add Terrel Shumway (individual CLA)
Add Than McIntosh (corporate CLA for Google Inc.)
Add Thomas de Zeeuw (individual CLA)
Add Tim Henderson (individual CLA)
Add Tom Wilkie (corporate CLA for Weaveworks)
Add Trey Lawrence (individual CLA)
Add Tristan Ooohry (individual CLA)
Add Tuo Shan (corporate CLA for Google Inc.)
Add Victor Chudnovsky (corporate CLA for Google Inc.)
Add Vitor De Mario (individual CLA)
Add Vladimir Mihailenco (individual CLA)
Add Vladimir Stefanovic (individual CLA)
Add Walter Poupore (corporate CLA for Google Inc.)
Add Xuyang Kang (individual CLA)
Add Zev Goldstein (individual CLA)
Updates #12042
Change-Id: I28d63babe225683b88f3f1501e529aed636c9ead
Reviewed-on: https://go-review.googlesource.com/33028
Reviewed-by: Ian Lance Taylor <iant@golang.org>
We add runtime/cgo to the list of import paths for various cases that
imply external linking mode, but before this change we did not add for
an explicit request of external linking mode. This fixes the case where
you are using a non-default buildmode that implies a different
compilation option (for example, -buildmode=pie implies -shared) and the
runtime/cgo package for that option is stale.
No test, as I'm not sure how to write one. It would require forcing a
stale runtime/cgo.
Change-Id: Id0409c7274ce67fe15d910baf587d3220cb53d83
Reviewed-on: https://go-review.googlesource.com/33070
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
For details, see the issues.
Fixes#11274.
Fixes#15137.
Change-Id: Ia11e71a054b3195e3007f490418a9c53a7e9cdf1
Reviewed-on: https://go-review.googlesource.com/33016
Reviewed-by: Alan Donovan <adonovan@google.com>
An unexported field of a struct is not visible outside of the package
that defines it, so the package path is implicitly part of the
definition of any struct with an unexported field.
Change-Id: I17c6aac822bd0c24188ab8ba1cc406d6b5d82771
Reviewed-on: https://go-review.googlesource.com/32820
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
It was a little tricky to figure out how to go from the documentation
to figuring out the best way to implement a Pool, so I thought I'd
try to provide a simple example. The implementation is mostly taken
from the fmt package.
I'm not happy with the verbosity of the calls to WriteString() etc,
but I wanted to provide a non-trivial example.
Change-Id: Id33a8b6cbf8eb278f71e1f78e20205b436578606
Reviewed-on: https://go-review.googlesource.com/24371
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Write output to a temp file first and only upon success
rename that file to source file name.
Fixes#8984.
Change-Id: Ie40e49d2a4eb3c9462fe769ccbf055b4366eceb0
Reviewed-on: https://go-review.googlesource.com/33018
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
We only support unmarshaling into a string or a []byte, but we
previously would try (and panic while) setting a slice of a different
type. The docs say ",innerxml" is ignored if the type is not string or
[]byte, so do that for other slices as well.
Fixes#15600.
Change-Id: Ia64815945a14c3d04a0a45ccf413e38b58a69416
Reviewed-on: https://go-review.googlesource.com/32919
Run-TryBot: Quentin Smith <quentin@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
A Go binary may only have 1 executable memory region if it has been
linked using internal linking. This change means that the test will
be skipped if this is the case, rather than fail.
Fixes#17852.
Change-Id: I59459a0f90ae8963aeb9908e5cb9fb64d7d0e0f4
Reviewed-on: https://go-review.googlesource.com/32920
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
- define syntax.Error for cleaner error reporting
- abort parsing after first error if no error handler is installed
- make sure to always report the first error, if any
- document behavior of API calls
- while at it: rename ReadXXX -> ParseXXX (clearer)
- adjust cmd/compile noder.go accordingly
Fixes#17774.
Change-Id: I7893eedea454a64acd753e32f7a8bf811ddbb03c
Reviewed-on: https://go-review.googlesource.com/32950
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
visit is just a func, and there's no formatting
verb for it, and it's on an internal-error path.
It has been thus many years, unchanged and unexecuted.
Change-Id: I4c2e2673ee9996218c24143bcc3be3eb4abdff25
Reviewed-on: https://go-review.googlesource.com/32970
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change adds code, originally written by Russ Cox <rsc@golang.org>
and open-sourced by Google, that converts from the "legacy"
binary pprof profile format to a struct representation of the
new protocol buffer pprof profile format.
This code reads the entire binary format for conversion to the
protobuf format. In a future change, we will update the code
to incrementally read and convert segments of the binary format,
so that the entire profile does not need to be stored in memory.
This change also contains contributions by Daria Kolistratova
<daria.kolistratova@intel.com> from the rolled-back change
golang.org/cl/30556 adapting the code to be used by the package
runtime/pprof.
This code also appeared in the change golang.org/cl/32257, which was based
on Daria Kolistratova's change, but was also rolled back.
Updates #16093
Change-Id: I5c768b1134bc15408d80a3ccc7ed867db9a1c63d
Reviewed-on: https://go-review.googlesource.com/32811
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Fix another case of a parallel test relying on a global variable
(DefaultTransport) implicitly.
Use the private Transport already in scope instead. It's closed at the
end, instead of randomly via another test.
Change-Id: I95e51926177ad19a766cabbb306782ded1bbb59b
Reviewed-on: https://go-review.googlesource.com/32913
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
A paranoid go at constant time implementation of P256 curve.
This code relies on z13 SIMD instruction set. For zEC12 and below,
the fallback is the existing P256 implementation. To facilitate this
fallback mode, I've refactored the code so that implementations can
be picked at run-time.
Its 'slightly' difficult to grok, but there is ASCII art..
name old time/op new time/op delta
BaseMultP256 419µs ± 3% 27µs ± 1% -93.65% (p=0.000 n=10+8)
ScalarMultP256 1.05ms ±10% 0.09ms ± 1% -90.94% (p=0.000 n=10+8)
Change-Id: Ic1ded898a2ceab055b1c69570c03179c4b85b177
Reviewed-on: https://go-review.googlesource.com/31231
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Add tmpdir as a parameter to the closure otherwise the subsequent
modifications to tmpdir causes only the last subdirectory to be
removed.
Additionally, add the missing argument for the t.Fatalf call.
Change-Id: I3df53f9051f7ea40cf3f846d47d9cefe445e9b9d
Reviewed-on: https://go-review.googlesource.com/32892
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
// Executable returns the path name for the executable that started
// the current process. There is no guarantee that the path is still
// pointing to the correct executable. If a symlink was used to start
// the process, depending on the operating system, the result might
// be the symlink or the path it pointed to. If a stable result is
// needed, path/filepath.EvalSymlinks might help.
//
// Executable returns an absolute path unless an error occurred.
//
// The main use case is finding resources located relative to an
// executable.
//
// Executable is not supported on nacl or OpenBSD (unless procfs is
// mounted.)
func Executable() (string, error) {
return executable()
}
Fixes#12773.
Change-Id: I469738d905b12f0b633ea4d88954f8859227a88c
Reviewed-on: https://go-review.googlesource.com/16551
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit also adds a test for pkg-config usage in cgo.
Fixes#16455.
Change-Id: I95fb6a288a4d19093c4613c93878017d95cbe4a2
Reviewed-on: https://go-review.googlesource.com/32735
Run-TryBot: Quentin Smith <quentin@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
CL 32871 updated the default cipher suites to use AES-GCM in
preference to ChaCha20-Poly1305 on platforms which have hardware
implementations of AES-GCM. This change makes BenchmarkThroughput
use the default cipher suites instead of the test cipher suites to
ensure that the recommended (fastest) algorithms are used.
Updates #17779.
Change-Id: Ib551223e4a00b5ea197d4d73748e1fdd8a47c32d
Reviewed-on: https://go-review.googlesource.com/32838
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
Windows has a limit of 260 characters on normal paths, but it's possible
to use longer paths by using "extended-length paths" that begin with
`\\?\`. This commit attempts to transparently convert an absolute path
to an extended-length path, following the subtly different rules those
paths require. It does not attempt to handle relative paths, which
continue to be passed to the operating system unmodified.
This adds a new test, TestLongPath, to the os package. This test makes
sure that it is possible to write a path at least 400 characters long
and runs on every platform. It also tests symlinks and hardlinks, though
symlinks are not testable with our builder configuration.
HasLink is moved to internal/testenv so it can be used by multiple tests.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
has Microsoft's documentation on extended-length paths.
Fixes#3358.
Fixes#10577.
Fixes#17500.
Change-Id: I4ff6bb2ef9c9a4468d383d98379f65cf9c448218
Reviewed-on: https://go-review.googlesource.com/32451
Run-TryBot: Quentin Smith <quentin@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Support for ChaCha20-Poly1305 ciphers was recently added to crypto/tls.
These ciphers are preferable in software, but they cannot beat hardware
support for AES-GCM, if present.
This change moves detection for hardware AES-GCM support into
cipher/internal/cipherhw so that it can be used from crypto/tls. Then,
when AES-GCM hardware is present, the AES-GCM cipher suites are
prioritised by default in crypto/tls. (Some servers, such as Google,
respect the client's preference between AES-GCM and ChaCha20-Poly1305.)
Fixes#17779.
Change-Id: I50de2be486f0b0b8052c4628d3e3205a1d54a646
Reviewed-on: https://go-review.googlesource.com/32871
Run-TryBot: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Some multipart data arrives in a stream, where subsequent parts may not
be ready yet. Read should return a complete part as soon as
possible.
Fixes#15431
Change-Id: Ie8c041b853f3e07f0f2a66fbf4bcab5fe9132a7c
Reviewed-on: https://go-review.googlesource.com/32032
Run-TryBot: Quentin Smith <quentin@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Cuts tests from 35 to 25 seconds.
Many of these could be parallel if the test runner were modified to
give each test its own workdir cloned from the tempdir files they
use. But later. This helps for now.
Updates #17751
Change-Id: Icc2ff87cca60a33ec5fd8abb1eb0a9ca3e85bf95
Reviewed-on: https://go-review.googlesource.com/32850
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>