- 26 Feb, 2019 36 commits
-
-
Josh Bleecher Snyder authored
As discussed in #29242, this optimization is for a bash-ism. No one writes Go code like this. In this repo, it triggers only in test/fixedbugs/bug425.go and that appears to be accidental. Fixes #29242 Change-Id: I257e6ecc73f24680f7282c6ab28729de4e8b27af Reviewed-on: https://go-review.googlesource.com/c/163728 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Russ Cox authored
Matching fmt, %#b now prints an 0b prefix, and %O prints octal with an 0o prefix. See golang.org/design/19308-number-literals for background. For #19308. For #12711. Change-Id: I139c5a9a1dfae15415621601edfa13c6a5f19cfc Reviewed-on: https://go-review.googlesource.com/c/160250Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
-
Russ Cox authored
big.Float already had %p for printing hex format, but that format normalizes differently from fmt's %x and ignores precision entirely. This CL adds %x to big.Float, matching fmt's behavior: the verb is spelled 'x' not 'p', the mantissa is normalized to [1, 2), and precision is respected. See golang.org/design/19308-number-literals for background. For #29008. Change-Id: I9c1b9612107094856797e5b0b584c556c1914895 Reviewed-on: https://go-review.googlesource.com/c/160249Reviewed-by: Robert Griesemer <gri@golang.org>
-
Josh Bleecher Snyder authored
Now that checknil has only a single caller, inline it. Passes toolstash-check. Change-Id: I5b13596bef84dd9a3e7f4bff8560903f1e54acfb Reviewed-on: https://go-review.googlesource.com/c/148829 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Daniel Martí authored
First, we can lift the enc.decodeMap nil check out of the loop. Second, we can make it clear to the compiler that 'in := src[0]' doesn't need a bounds check, by making len(src)==0 a single if check that always stops the loop. This is by far the largest speed-up. Third, we can use a dst slice index instead of reslicing dst, which removes work from the loop body. While at it, we can merge the two 'switch dlen' pieces of code, which simplifies the code and doesn't affect performance. name old time/op new time/op delta DecodeString-8 80.2µs ± 0% 67.5µs ± 0% -15.81% (p=0.002 n=6+6) name old speed new speed delta DecodeString-8 163MB/s ± 0% 194MB/s ± 0% +18.78% (p=0.002 n=6+6) Change-Id: Iefeaae94c03453f8760452b1da706a77b3522718 Reviewed-on: https://go-review.googlesource.com/c/154422 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Agniva De Sarker authored
CL 150377 made the change of converting smart quotes to their html escaped entities for ToHTML, and to unicode quotes for ToText. But for ToText, the change converted the quotes in pre-formatted text too. This fixes that behavior to not touch any text in pre-formatted blocks, which also makes the behavior consistent with ToHTML. Fixes #29730 Change-Id: I58e0216cbdbe189d06d82147e5a02b620af14734 Reviewed-on: https://go-review.googlesource.com/c/162922 Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
-
Agniva De Sarker authored
Fixes #30087 Change-Id: Ic6d80f8e6e1831886af8613420b1bd129a1b4850 Reviewed-on: https://go-review.googlesource.com/c/161577Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Marat Khabibullin authored
Comparing err variable to be not nil is redundant in this case. The code above ensures that it is always not nil. Updates #30208 Change-Id: I0a41601273de36a05d22270a743c0bdedeb1d0bf GitHub-Last-Rev: 372e0fd48f90f33e266fbcdf2ccf87b9f1311c4f GitHub-Pull-Request: golang/go#30213 Reviewed-on: https://go-review.googlesource.com/c/162439Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Michael Fraenkel authored
When looking for the field specified in a composite literal, check that the specified name is actually a field and not a method. Fixes #29855. Change-Id: Id77666e846f925907b1eec64213b1d25af8a2466 Reviewed-on: https://go-review.googlesource.com/c/158938 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
-
Marat Khabibullin authored
The variable err could have nil value when we call err.Error(), because after we check it for nil above we continue the test (t.Errorf doesn't stop the test execution). Updates #30208 Change-Id: Ibcf38698326c69c06068989510311e37806995c6 GitHub-Last-Rev: 3ab20f6d7fe34ed9b777e0894b57166d173de8ca GitHub-Pull-Request: golang/go#30214 Reviewed-on: https://go-review.googlesource.com/c/162457Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Filippo Valsorda authored
Change-Id: I8ea3043fcbaf7a5f73b2a796171a7f1cb3cb3693 Reviewed-on: https://go-review.googlesource.com/c/158818 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Josh Bleecher Snyder authored
The special case for ODOTPTR to handle zero-width fields is unneeded. It is an artifact of the old backend, from which time this code dates. The Node to SSA converter is careful to insert a nil check. This is tested in test/nilptr2.go, among other places. Passes toolstash-check. Change-Id: I6c1d99f7ff5abdae9aa08ee047dc088a3fe8dc3c Reviewed-on: https://go-review.googlesource.com/c/148828 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
-
Elias Naur authored
They don't work on Android but will be run if the host has gfortran installed. Change-Id: I983c5695a9e963def90e4f8264fb00077a0c5e53 Reviewed-on: https://go-review.googlesource.com/c/163838 Run-TryBot: Elias Naur <mail@eliasnaur.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Ketan Parmar authored
Change-Id: Ib00fcfd46eae27eea0a3d4cab4406f4c461fb57b Reviewed-on: https://go-review.googlesource.com/c/160517Reviewed-by: Andrew Bonventre <andybons@golang.org> Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Daniel Martí authored
Trying to call a method on a nil interface is a panic in Go. For example: var stringer fmt.Stringer println(stringer.String()) // nil pointer dereference In https://golang.org/cl/143097 we started recovering panics encountered during function and method calls. However, we didn't handle this case, as text/template panics before evalCall is ever run. In particular, reflect's MethodByName will panic if the receiver is of interface kind and nil: panic: reflect: Method on nil interface value Simply add a check for that edge case, and have Template.Execute return a helpful error. Note that Execute shouldn't just error if the interface contains a typed nil, since we're able to find a method to call in that case. Finally, add regression tests for both the nil and typed nil interface cases. Fixes #30143. Change-Id: Iffb21b40e14ba5fea0fcdd179cd80d1f23cabbab Reviewed-on: https://go-review.googlesource.com/c/161761 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
-
Daniel Martí authored
Its only use was removed in golang.org/cl/114797, committed in October 2018. Change-Id: I6560ccfb10d7c763f6470b20c853716779c18cee Reviewed-on: https://go-review.googlesource.com/c/158897 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
-
Elias Naur authored
We've got away with not copying the testdata directories for the standard library because the exec wrapper also pushes almost the entire $GOROOT tree to the device, including testdata directories. Similar to what the iOS exec wrapper does. Change-Id: I91ef63ef84a658fc8843002890132c64b7c1d20e Reviewed-on: https://go-review.googlesource.com/c/163626 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Elias Naur authored
Android emulator builders are soon to join the trybot set. To avoid flaky runs, work around a longstanding adb bug where concurrent adb commands sometimes fail. I haven't seen the problem on actual devices until recently. It seems that the recently added "adb wait-for-device" can introduce flakyness with errors such as: adb: error: failed to get feature set: protocol fault (couldn't read status): Connection reset by peer Instead of working around that, give up and serialize use of adb everywhere. Fixes #23795 Updates #23824 Change-Id: If347c9981fa32ff8a1e14b7454f122ef682450a6 Reviewed-on: https://go-review.googlesource.com/c/163625Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Elias Naur authored
To run the standard library tests on Android, the androidtest.bash script copies GOROOT to the device. Move that logic to the android exec wrapper, thereby making androidtest.bash obsolete. Apart from making Android less special, the sharded builder infrastructure should now be able to run (emulated) Android builders and trybots without special treatment. Updates #23824 Change-Id: I41591fea9a15b38c6dcf84046ea57f1e9165eaa5 Reviewed-on: https://go-review.googlesource.com/c/163619 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Elias Naur authored
Fixes #29423 Change-Id: I376d0776c3810c2273d1ea234ebe681d5fd2ae64 Reviewed-on: https://go-review.googlesource.com/c/163623 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
-
Elias Naur authored
The androidtest.bash script encodes the additional steps to build Go and run tests on Android. In order to add sharded builders and trybots, Android needs to fit into the usual make.bash + cmd/dist test pattern. This change moves building the exec wrapper into cmd/dist bootstrap. Do the same for iOS while we're here. Updates #23824 Change-Id: I58a1b0679c3a6c92fdc7fff464b469641f1fee74 Reviewed-on: https://go-review.googlesource.com/c/163618 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Michael Munday authored
Use ReverseBytes32 and ReverseBytes64 to speed up these functions. The byte reversal functions are intrinsics on most platforms and generally compile to a single instruction. name old time/op new time/op delta Reverse32 2.41ns ± 1% 1.94ns ± 3% -19.60% (p=0.000 n=20+19) Reverse64 3.85ns ± 1% 2.56ns ± 1% -33.32% (p=0.000 n=17+19) Change-Id: I160bf59a0c7bd5db94114803ec5a59fae448f096 Reviewed-on: https://go-review.googlesource.com/c/159358 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
-
Iskander Sharipov authored
The old code looks suspicious and is fragile. It would fail if error messages were not totally the same. Swapped the arguments order to fix that. Change-Id: Id5df7242fb9224d0090245286ef8986ebb15e921 Reviewed-on: https://go-review.googlesource.com/c/161157 Run-TryBot: Iskander Sharipov <quasilyte@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
-
Daniel Martí authored
If we're accessing a field on a nil struct pointer, and that field is present in the type, we should print a "nil pointer evaluating X.Y" error instead of the broader "can't evaluate field Y in X". The latter error should still be used for the cases where the field is simply missing. While at it, remove the isNil checks in the struct and map cases. The indirect func will only return a true isNil when returning a pointer or interface reflect.Value, so it's impossible for either of these checks to be useful. Finally, extend the test suite to test a handful of these edge cases, including the one shown in the original issue. Fixes #29137. Change-Id: I53408ced8a7b53807a0a8461b6baef1cd01d25ae Reviewed-on: https://go-review.googlesource.com/c/153341 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
-
Daniel Martí authored
I forgot how to pull up the ssa debug options help, so instead of writing -d=ssa/help, I just wrote -d=ssa/. Much to my amusement, the compiler just crashed, as shown below. Fix that. panic: runtime error: index out of range goroutine 1 [running]: cmd/compile/internal/ssa.PhaseOption(0x7ffc375d2b70, 0x0, 0xdbff91, 0x5, 0x1, 0x0, 0x0, 0x1, 0x1) /home/mvdan/tip/src/cmd/compile/internal/ssa/compile.go:327 +0x1876 cmd/compile/internal/gc.Main(0xde7bd8) /home/mvdan/tip/src/cmd/compile/internal/gc/main.go:411 +0x41d0 main.main() /home/mvdan/tip/src/cmd/compile/main.go:51 +0xab Change-Id: Ia2ad394382ddf8f4498b16b5cfb49be0317fc1aa Reviewed-on: https://go-review.googlesource.com/c/154421 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
-
Alberto Donizetti authored
Go 1.12 is released, but it's currently not listed in the https://golang.org/project page. Change-Id: Ib5820f74245e4c986014c64eb40fa2911473e64b Reviewed-on: https://go-review.googlesource.com/c/163837Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Alberto Donizetti authored
The example for Nanoseconds() currently reads: ns, _ := time.ParseDuration("1000ns") fmt.Printf("one microsecond has %d nanoseconds.", ns.Nanoseconds()) which is not terribly interesting: it seems obvious that parsing "1000ns" and then calling Nanoseconds() will print 1000. The mention of microseconds in the text suggests that the author's intention was, instead, to write something like this: u, _ := time.ParseDuration("1us") i.e. build a time value by parsing 1 microsecond, and then print the value in nanoseconds. Change the example to do this. Change-Id: I4ddb123f0935a12cda3b5d6f1ca919bfcd6383d6 Reviewed-on: https://go-review.googlesource.com/c/163622Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-
Bryan C. Mills authored
I hope that this will fix the tests on iOS, but 'gomote create' isn't giving me an instance I can test with. (Please patch and test before approving.) Updates #15919 Updates #30228 Change-Id: I1b7cd30d5b127a1ad3243b329fa005d229f69a24 Reviewed-on: https://go-review.googlesource.com/c/163726 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Elias Naur <mail@eliasnaur.com>
-
Russ Cox authored
This CL updates text/template's scanner to accept the new number syntaxes: - Hexadecimal floating-point values. - Digit-separating underscores. - Leading 0b and 0o prefixes. See golang.org/design/19308-number-literals for background. For #12711. For #19308. For #28493. For #29008. Change-Id: I68c16ea35c3f506701063781388de72bafee6b8d Reviewed-on: https://go-review.googlesource.com/c/160248Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
-
Russ Cox authored
This CL updates fmt's scanner to accept the new number syntaxes: - Hexadecimal floating-point values. - Digit-separating underscores. - Leading 0b and 0o prefixes. See golang.org/design/19308-number-literals for background. For #12711. For #19308. For #28493. For #29008. Change-Id: I5582af5c94059c781e6cf4e862441d3df3006adf Reviewed-on: https://go-review.googlesource.com/c/160247Reviewed-by: Robert Griesemer <gri@golang.org>
-
Russ Cox authored
This CL modifies fmt's printer to implement %#b and %O to emit leading 0b and 0o prefixes on binary and octal. (%#o is already taken and emits "0377"; %O emits "0o377".) See golang.org/design/19308-number-literals for background. For #19308. For #12711. Vet update is #29986. Change-Id: I7c38a4484c48a03abe9f6d45c7d981c7c314f583 Reviewed-on: https://go-review.googlesource.com/c/160246Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Rob Pike <r@golang.org>
-
Russ Cox authored
This CL modifies fmt's printer to implement %x and %X for formatting floating-point data (floats and complexes) in standard hexadecimal notation. See golang.org/design/19308-number-literals for background. For #29008. Vet update is #29986. Change-Id: If2842a11631bc393a1ebcf6914ed07658652af5a Reviewed-on: https://go-review.googlesource.com/c/160245Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Rob Pike <r@golang.org>
-
Bryan C. Mills authored
Updates #30241 Change-Id: I543d8914faf810835d3327baa3c84b3dff124156 Reviewed-on: https://go-review.googlesource.com/c/163519Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Bryan C. Mills authored
Updates #30228 Change-Id: I41bbedf15fa51242f69a3b1ecafd0d3191271799 Reviewed-on: https://go-review.googlesource.com/c/163518Reviewed-by: Jay Conrod <jayconrod@google.com>
-
Bryan C. Mills authored
These source files fail to build with 'go test ./...'. Move them into testdata so that only test.bash will see them. Updates #30228 Change-Id: I3673f3cb64b0c128a2bca5fee7679b672fe90770 Reviewed-on: https://go-review.googlesource.com/c/163212Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
Bryan C. Mills authored
Add _test.go files in the individal directories to invoke 'go build' with appropriate arguments. Move the test driver out of cmd/dist so that it's easier to invoke the test separately (using 'go test .'). Updates #30228 Updates #28387 Change-Id: Ibc4a024a52c12a274058298b41cc90709f7f56c8 Reviewed-on: https://go-review.googlesource.com/c/163420Reviewed-by: Ian Lance Taylor <iant@golang.org>
-
- 25 Feb, 2019 4 commits
-
-
Andrew authored
Change-Id: I845375d2b3824211b80885228ba5b45503cba1a6 Reviewed-on: https://go-review.googlesource.com/c/163722Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Andrew authored
Change-Id: Ib6a0f5c35b1efc3f3c8e7ca2a5c4f35bf8bf5e5d Reviewed-on: https://go-review.googlesource.com/c/163720Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Andrew authored
Using go get prevents the failure case of when the user doesn't have the repo on their machine. Change-Id: I9c1174087728b5b06b578b0d52df6eeb7e8c7a3c Reviewed-on: https://go-review.googlesource.com/c/163718Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-
Lynn Boger authored
A recent change to fix stacktraces for inlined functions introduced a regression on ppc64le when compiling position independent code. That happened because ginsnop2 was called for the purpose of inserting a NOP to identify the location of the inlined function, when ginsnop should have been used. ginsnop2 is intended to be used before deferreturn to ensure r2 is properly restored when compiling position independent code. In some cases the location where r2 is loaded from might not be initialized. If that happens and r2 is used to generate an address, the result is likely a SEGV. This fixes that problem. Fixes #30283 Change-Id: If70ef27fc65ef31969712422306ac3a57adbd5b6 Reviewed-on: https://go-review.googlesource.com/c/163337Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com> Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-