- 17 Oct, 2016 17 commits
-
-
Brad Fitzpatrick authored
The driver.Valuer interface lets types map their Go representation to a suitable database/sql/driver.Value. If a user defines the Value method with a value receiver, such as: type MyStr string func (s MyStr) Value() (driver.Value, error) { return strings.ToUpper(string(s)), nil } Then they can't use (*MyStr)(nil) as an argument to an SQL call via database/sql, because *MyStr also implements driver.Value, but via a compiler-generated wrapper which checks whether the pointer is nil and panics if so. We now accept (*MyStr)(nil) and map it to "nil" (an SQL "NULL") if the Valuer method is implemented on MyStr instead of *MyStr. If a user implements the driver.Value interface with a pointer receiver, they retain full control of what nil means: type MyStr string func (s *MyStr) Value() (driver.Value, error) { if s == nil { return "missing MyStr", nil } return strings.ToUpper(string(*s)), nil } Adds tests for both cases. Fixes #8415 Change-Id: I897d609d80d46e2354d2669a8a3e090688eee3ad Reviewed-on: https://go-review.googlesource.com/31259 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Daniel Theophanes <kardianos@gmail.com> Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org>
-
Russ Cox authored
Delete vendored copy. Change-Id: I06e9d3b709553a1a8d06275e99bd8f617aac5788 Reviewed-on: https://go-review.googlesource.com/31011Reviewed-by:
Ian Lance Taylor <iant@golang.org>
-
Russ Cox authored
This allows use of newer math/big (and later debug/pe) without maintaining a vendored copy somewhere in cmd. Use for math/big, deleting cmd/compile/internal/big. Change-Id: I2bffa7a9ef115015be29fafdb02acc3e7a665d11 Reviewed-on: https://go-review.googlesource.com/31010Reviewed-by:
Minux Ma <minux@golang.org> Reviewed-by:
Ian Lance Taylor <iant@golang.org>
-
Russ Cox authored
1. Define behavior for Unmarshal of JSON null into Unmarshaler and TextUnmarshaler. Specifically, an Unmarshaler will be given the literal null and can decide what to do (because otherwise json.RawMessage is impossible to implement), and a TextUnmarshaler will be skipped over (because there is no text to unmarshal), like most other inappropriate types. Document this in Unmarshal, with a reminder in UnmarshalJSON about handling null. 2. Test all this. 3. Fix the TextUnmarshaler case, which was returning an unmarshalling error, to match the definition. 4. Fix the error that had been used for the TextUnmarshaler, since it was claiming that there was a JSON string when in fact the problem was NOT having a string. 5. Adjust time.Time and big.Int's UnmarshalJSON to ignore null, as is conventional. Fixes #9037. Change-Id: If78350414eb8dda712867dc8f4ca35a9db041b0c Reviewed-on: https://go-review.googlesource.com/30944Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org>
-
Ben Burkert authored
The CloseWrite method sends a close_notify alert record to the other side of the connection. This record indicates that the sender has finished sending on the connection. Unlike the Close method, the sender may still read from the connection until it recieves a close_notify record (or the underlying connection is closed). This is analogous to a TCP half-close. Updates #8579 Change-Id: I9c6bc193efcb25cc187f7735ee07170afa7fdde3 Reviewed-on: https://go-review.googlesource.com/25159Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Victor Vrantchan authored
For #16360. Change-Id: I99d1e5ab1f814f65b3066a498158a442f1bd477f Reviewed-on: https://go-review.googlesource.com/31137 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org>
-
Martin Möhrmann authored
Copies utf8 constants and EncodeRune implementation from unicode/utf8. Adds a new decoderune implementation that is used by the compiler in code generated for ranging over strings. It does not handle ASCII runes since these are handled directly before calls to decoderune. The DecodeRuneInString implementation from unicode/utf8 is not used since it uses a lookup table that would increase the use of cpu caches. Adds more tests that check decoding of valid and invalid utf8 sequences. name old time/op new time/op delta RuneIterate/range2/ASCII-4 7.45ns ± 2% 7.45ns ± 1% ~ (p=0.634 n=16+16) RuneIterate/range2/Japanese-4 53.5ns ± 1% 49.2ns ± 2% -8.03% (p=0.000 n=20+20) RuneIterate/range2/MixedLength-4 46.3ns ± 1% 41.0ns ± 2% -11.57% (p=0.000 n=20+20) new: "".decoderune t=1 size=423 args=0x28 locals=0x0 old: "".charntorune t=1 size=666 args=0x28 locals=0x0 Change-Id: I1df1fdb385bb9ea5e5e71b8818ea2bf5ce62de52 Reviewed-on: https://go-review.googlesource.com/28490 Run-TryBot: Martin Möhrmann <martisch@uos.de> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org>
-
Emmanuel Odeke authored
Referencing RFC 7230 Section 3.3.2, this CL deduplicates multiple identical Content-Length headers of a message or rejects the message as invalid if the Content-Length values differ. Fixes #16490 Change-Id: Ia6b0f58ec7d35710b11a36113d2bd9128f693f64 Reviewed-on: https://go-review.googlesource.com/31252Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
David du Colombier authored
Deadlines aren't implemented on Plan 9 yet. Updates #17477. Change-Id: I44ffdbef97276dfec56547e5189672b7da24bfc1 Reviewed-on: https://go-review.googlesource.com/31188Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: David du Colombier <0intro@gmail.com>
-
Klaus Post authored
The incorrect table was used for estimating output size. This can give suboptimal selection of entropy encoder in rare cases. Change-Id: I8b358200f2d1f9a3f9b79a44269d7be704e1d2d9 Reviewed-on: https://go-review.googlesource.com/31172Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Yasuhiro Matsumoto authored
Fixes #16736 Change-Id: I335d201e3f6738d838de3881087cb640fc7670e8 Reviewed-on: https://go-review.googlesource.com/30578 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Daniel Theophanes authored
Modify the new Context methods to take a name-value driver struct. This will require more modifications to drivers to use, but will reduce the overall number of structures that need to be maintained over time. Fixes #12381 Change-Id: I30747533ce418a1be5991a0c8767a26e8451adbd Reviewed-on: https://go-review.googlesource.com/30166Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Martin Möhrmann authored
In ReadRune store the size of the rune that was read into lastRead to avoid the need to call DecodeRuneLast in UnreadRune. fmt: name old time/op new time/op delta ScanInts-4 481µs ± 4% 458µs ± 3% -4.64% (p=0.000 n=20+20) Change-Id: I500848e663a975f426402a4b3d27a541e5cac06c Reviewed-on: https://go-review.googlesource.com/28817Reviewed-by:
Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Run-TryBot: Martin Möhrmann <martisch@uos.de> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Brad Fitzpatrick authored
Updates #16456 Change-Id: Ifea651ea3ece2267a6f0c1638181d6ddd9248a9f Reviewed-on: https://go-review.googlesource.com/31181Reviewed-by:
Ian Lance Taylor <iant@golang.org>
-
Brad Fitzpatrick authored
Flesh out nacl's fake network system to match how all the other platforms work: all other systems' SetReadDeadline and SetWriteDeadline affect currently-blocked read & write calls. This was documented in golang.org/cl/30164 because it was the status quo and existing packages relied on it. (notably the net/http package) And add a test. Change-Id: I074a1054dcabcedc97b173dad5e827f8babf7cfc Reviewed-on: https://go-review.googlesource.com/31178 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Ian Lance Taylor <iant@golang.org>
-
Caleb Spare authored
Template.escape makes the assumption that t.Lookup(t.Name()) is t (escapeTemplate looks up the associated template by name and sets escapeErr appropriately). This assumption did not hold for a Cloned template, because the template associated with t.Name() was a second copy of the original. Add a test for the assumption that t.Lookup(t.Name()) == t. One effect of this broken assumption was #16101: parallel Executes racily accessed the template namespace because each Execute call saw t.escapeErr == nil and re-escaped the template concurrently with read accesses occurring outside the namespace mutex. Add a test for this race. Related to #12996 and CL 16104. Fixes #16101 Change-Id: I59831d0847abbabb4ef9135f2912c6ce982f9837 Reviewed-on: https://go-review.googlesource.com/31092 Run-TryBot: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Rob Pike <r@golang.org>
-
Alex Brainman authored
Fixes #17439 Change-Id: I7caa28519f38692f9ca306f0789cbb975fa1d7c4 Reviewed-on: https://go-review.googlesource.com/31112Reviewed-by:
Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
- 16 Oct, 2016 6 commits
-
-
Rob Pike authored
Fixes #16423 Change-Id: I9635db295be4d356d427adadd309084e16c4582f Reviewed-on: https://go-review.googlesource.com/31255Reviewed-by:
Ian Lance Taylor <iant@golang.org>
-
Rob Pike authored
Exit code 3 is unprecedented and inconsistent with other failures here, such as having no tool directory. Fixes #17145 Change-Id: Ie7ed56494d4511a600214666ce3a726d63a8fd8e Reviewed-on: https://go-review.googlesource.com/31253Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Brad Fitzpatrick authored
No need to skip it. It passes. Maybe it was fixed at some point. Change-Id: I9848924aefda44f9b3a574a8705fa549d657f28d Reviewed-on: https://go-review.googlesource.com/31177 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Mikio Hara <mikioh.mikioh@gmail.com>
-
Brad Fitzpatrick authored
Change-Id: Ibae0be046c6a6596d3a98b094ec5f089bb68be7a Reviewed-on: https://go-review.googlesource.com/31182Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org>
-
Hiroshi Ioka authored
Change-Id: I8a176ed9c7f59ebdfd39c1e2b88905f977179982 Reviewed-on: https://go-review.googlesource.com/31119Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Alex Carol authored
Change-Id: Idca6115181960eed7a955027ee77a02decb4e7f2 Reviewed-on: https://go-review.googlesource.com/31179Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org>
-
- 15 Oct, 2016 8 commits
-
-
Austin Clements authored
The error check patterns in this test are more complex than necessary because f2 gets inlined into f1. This behavior isn't important to the test, so disable inlining of f2 and simplify the error check patterns. Change-Id: Ia8aee92a52f9217ad71b89b2931494047e8d2185 Reviewed-on: https://go-review.googlesource.com/31132 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Keith Randall <khr@golang.org>
-
Austin Clements authored
Currently we use go:nowritebarrier in many places in proc.go. go:notinheap and go:yeswritebarrierrec now let us use go:nowritebarrierrec (the recursive form of the go:nowritebarrier pragma) more liberally. Do so in proc.go Change-Id: Ia7fcbc12ce6c51cb24730bf835fb7634ad53462f Reviewed-on: https://go-review.googlesource.com/30942Reviewed-by:
Rick Hudson <rlh@golang.org>
-
Austin Clements authored
This covers basically all sysAlloc'd, persistentalloc'd, and fixalloc'd types. Change-Id: I0487c887c2a0ade5e33d4c4c12d837e97468e66b Reviewed-on: https://go-review.googlesource.com/30941Reviewed-by:
Rick Hudson <rlh@golang.org>
-
Austin Clements authored
Currently mspan links to its previous mspan using a **mspan field that points to the previous span's next field. This simplifies some of the list manipulation code, but is going to make it very hard to convince the compiler that mspan list manipulations don't need write barriers. Fix this by using a more traditional ("boring") linked list that uses a simple *mspan pointer to the previous mspan. This complicates some of the list manipulation slightly, but it will let us eliminate all write barriers from the mspan list manipulation code by marking mspan go:notinheap. Change-Id: I0d0b212db5f20002435d2a0ed2efc8aa0364b905 Reviewed-on: https://go-review.googlesource.com/30940Reviewed-by:
Rick Hudson <rlh@golang.org>
-
Austin Clements authored
This adds a //go:notinheap pragma for declarations of types that must not be heap allocated. We ensure these rules by disallowing new(T), make([]T), append([]T), or implicit allocation of T, by disallowing conversions to notinheap types, and by propagating notinheap to any struct or array that contains notinheap elements. The utility of this pragma is that we can eliminate write barriers for writes to pointers to go:notinheap types, since the write barrier is guaranteed to be a no-op. This will let us mark several scheduler and memory allocator structures as go:notinheap, which will let us disallow write barriers in the scheduler and memory allocator much more thoroughly and also eliminate some problematic hybrid write barriers. This also makes go:nowritebarrierrec and go:yeswritebarrierrec much more powerful. Currently we use go:nowritebarrier all over the place, but it's almost never what you actually want: when write barriers are illegal, they're typically illegal for a whole dynamic scope. Partly this is because go:nowritebarrier has been around longer, but it's also because go:nowritebarrierrec couldn't be used in situations that had no-op write barriers or where some nested scope did allow write barriers. go:notinheap eliminates many no-op write barriers and go:yeswritebarrierrec makes it possible to opt back in to write barriers, so these two changes will let us use go:nowritebarrierrec far more liberally. This updates #13386, which is about controlling pointers from non-GC'd memory to GC'd memory. That would require some additional pragma (or pragmas), but could build on this pragma. Change-Id: I6314f8f4181535dd166887c9ec239977b54940bd Reviewed-on: https://go-review.googlesource.com/30939Reviewed-by:
Keith Randall <khr@golang.org> Reviewed-by:
Matthew Dempsky <mdempsky@google.com>
-
Austin Clements authored
This pragma cancels the effect of go:nowritebarrierrec. This is useful in the scheduler because there are places where we enter a function without a valid P (and hence cannot have write barriers), but then obtain a P. This allows us to annotate the function with go:nowritebarrierrec and split out the part after we've obtained a P into a go:yeswritebarrierrec function. Change-Id: Ic8ce4b6d3c074a1ecd8280ad90eaf39f0ffbcc2a Reviewed-on: https://go-review.googlesource.com/30938Reviewed-by:
Matthew Dempsky <mdempsky@google.com> Reviewed-by:
Keith Randall <khr@golang.org>
-
Ilya Tocar authored
This simplifies code and provides performance iprovments: Similar to https://go-review.googlesource.com/#/c/28577 CountHard1-48 1.74ms ±14% 0.17ms ±14% -90.16% (p=0.000 n=19+19) CountHard2-48 1.78ms ±15% 0.25ms ±13% -86.10% (p=0.000 n=19+20) CountHard3-48 1.78ms ±12% 0.80ms ±11% -55.19% (p=0.000 n=17+20) CountTorture-48 13.5µs ±14% 13.6µs ±11% ~ (p=0.625 n=18+19) CountTortureOverlapping-48 6.92ms ±13% 8.42ms ±11% +21.72% (p=0.000 n=19+17) Change-Id: Ief120aee918a66487c76be56e0796871c8502f89 Reviewed-on: https://go-review.googlesource.com/28586 Run-TryBot: Ilya Tocar <ilya.tocar@intel.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org>
-
Daniel Theophanes authored
Many database systems allow returning multiple result sets in a single query. This can be useful when dealing with many intermediate results on the server and there is a need to return more then one arity of data to the client. Fixes #12382 Change-Id: I480a9ac6dadfc8743e0ba8b6d868ccf8442a9ca1 Reviewed-on: https://go-review.googlesource.com/30592Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
- 14 Oct, 2016 3 commits
-
-
Rob Pike authored
If a labeled statement is the target of a goto, we must treat it as the boundary of a new basic block, but only if it is not already the boundary of a basic block such as a labeled for loop. Fixes #16624 Now reports 100% coverage for the test in the issue. Change-Id: If118bb6ff53a96c738e169d92c03cb3ce97bad0e Reviewed-on: https://go-review.googlesource.com/30977Reviewed-by:
Ian Lance Taylor <iant@golang.org> Reviewed-by:
Robert Griesemer <gri@golang.org>
-
Robert Griesemer authored
Fixes #17398. Change-Id: Iac7899031c1bfbadc4f84e5b374eaf1f01dff8c8 Reviewed-on: https://go-review.googlesource.com/31190Reviewed-by:
Rob Pike <r@golang.org> Reviewed-by:
Matthew Dempsky <mdempsky@google.com>
-
Alex Brainman authored
Fixes #15355 Change-Id: Idbab7a627c5de249bb62d519c5a47f3d2f6c82a7 Reviewed-on: https://go-review.googlesource.com/22796Reviewed-by:
Russ Cox <rsc@golang.org> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
- 13 Oct, 2016 6 commits
-
-
Brad Fitzpatrick authored
Make a zero-byte write to a hijacked connection not log anything, so handlers can test whether a connection is hacked by doing a Write(nil). Fixes #16456 Change-Id: Id56caf822c8592067bd8422672f0c1aec89e866c Reviewed-on: https://go-review.googlesource.com/30812Reviewed-by:
Joe Tsai <thebrokentoaster@gmail.com>
-
Michael Munday authored
Adds a test to check that block cipher modes accept a zero-length input. Fixes #17435. Change-Id: Ie093c4cdff756b5c2dcb79342e167b3de5622389 Reviewed-on: https://go-review.googlesource.com/31070 Run-TryBot: Michael Munday <munday@ca.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org>
-
Filippo Valsorda authored
Closes #15815 Change-Id: I08154dbff416198cf7787e446b1e00e62c03a972 Reviewed-on: https://go-review.googlesource.com/30917Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Austin Clements authored
This clarifies some of the titles so they're more "news" friendly and less implementation-oriented. Change-Id: Ied02aa1e6824b04db5d32ecdd58e972515b1f588 Reviewed-on: https://go-review.googlesource.com/29830Reviewed-by:
Rick Hudson <rlh@golang.org>
-
Alan Donovan authored
This change is a copy of CL 22788 in x/tools. It has no observable effect yet, but brings the two packages in synch. Change-Id: I266c77547cb46deb69b1a36e1674dfebc430e3a5 Reviewed-on: https://go-review.googlesource.com/22936Reviewed-by:
Russ Cox <rsc@golang.org>
-
Alex Brainman authored
This CL also includes vendored copy of debug/pe, otherwise bootstrapping fails. Updates #15345 Change-Id: I3a8ac990e3cb12cb4d24ec11b618b68190397fd1 Reviewed-on: https://go-review.googlesource.com/22603Reviewed-by:
Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-