]> Cypherpunks repositories - gostls13.git/log
gostls13.git
13 years agopath/filepath: added Rel as the complement of Abs
Gustavo Niemeyer [Tue, 4 Oct 2011 14:27:06 +0000 (11:27 -0300)]
path/filepath: added Rel as the complement of Abs

R=golang-dev, rsc, gustavo, r, borman
CC=golang-dev
https://golang.org/cl/4981049

13 years agocgo: allow Window's specific path characters in flag directives.
Joe Poirier [Tue, 4 Oct 2011 04:07:28 +0000 (15:07 +1100)]
cgo: allow Window's specific path characters in flag directives.

Example: #cgo windows LDFLAGS: -LC:\\WINDOWS\\system32

R=alex.brainman, go.peter.90, golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5154042

13 years agoFix build, disabling flaky registerization test.
Brad Fitzpatrick [Tue, 4 Oct 2011 00:25:55 +0000 (17:25 -0700)]
Fix build, disabling flaky registerization test.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5179045

13 years agoimage: spin off a new color package out of the image package.
Nigel Tao [Tue, 4 Oct 2011 00:09:03 +0000 (11:09 +1100)]
image: spin off a new color package out of the image package.

The spin-off renames some types. The new names are simply better:
image.Color              -> color.Color
image.ColorModel         -> color.Model
image.ColorModelFunc     -> color.ModelFunc
image.PalettedColorModel -> color.Palette
image.RGBAColor          -> color.RGBA
image.RGBAColorModel     -> color.RGBAModel
image.RGBA64Color        -> color.RGBA64
image.RGBA64ColorModel   -> color.RGBA64Model
(similarly for NRGBAColor, GrayColorModel, etc)

The image.ColorImage type stays in the image package, but is renamed:
image.ColorImage -> image.Uniform

The image.Image implementations (image.RGBA, image.RGBA64, image.NRGBA,
image.Alpha, etc) do not change their name, and gain a nice symmetry:
an image.RGBA is an image of color.RGBA, etc.

The image.Black, image.Opaque uniform images remain unchanged (although
their type is renamed from image.ColorImage to image.Uniform). The
corresponding color types (color.Black, color.Opaque, etc) are new.

Nothing in the image/ycbcr is renamed yet. The ycbcr.YCbCrColor and
ycbcr.YCbCrImage types will eventually migrate to color.YCbCr and
image.YCbCr, but that will be a separate CL.

R=r, bsiegert
CC=golang-dev
https://golang.org/cl/5132048

13 years agodoc: update tutorial.
Rob Pike [Mon, 3 Oct 2011 23:18:47 +0000 (16:18 -0700)]
doc: update tutorial.
Fix for new regexp library ($ isn't end of line any more).
Don't assume . is in PATH.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5175052

13 years agostrings: implement a faster byte->string Replacer
Brad Fitzpatrick [Mon, 3 Oct 2011 22:19:04 +0000 (15:19 -0700)]
strings: implement a faster byte->string Replacer

This implements a replacer for when all old strings are single
bytes, but new values are not.

BenchmarkHTMLEscapeNew   1000000   1090 ns/op
BenchmarkHTMLEscapeOld   1000000   2049 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/5176043

13 years ago5g, 6g, 8g: registerize variables again
Russ Cox [Mon, 3 Oct 2011 21:46:36 +0000 (17:46 -0400)]
5g, 6g, 8g: registerize variables again

My previous CL:

changeset:   9645:ce2e5f44b310
user:        Russ Cox <rsc@golang.org>
date:        Tue Sep 06 10:24:21 2011 -0400
summary:     gc: unify stack frame layout

introduced a bug wherein no variables were
being registerized, making Go programs 2-3x
slower than they had been before.

This CL fixes that bug (along with some others
it was hiding) and adds a test that optimization
makes at least one test case faster.

R=ken2
CC=golang-dev
https://golang.org/cl/5174045

13 years agostrings: implement a faster byte->byte Replacer
Brad Fitzpatrick [Mon, 3 Oct 2011 20:12:01 +0000 (13:12 -0700)]
strings: implement a faster byte->byte Replacer

When all old & new string values are single bytes,
byteReplacer is now used, instead of the generic
algorithm.

BenchmarkGenericMatch       10000  102519 ns/op
BenchmarkByteByteMatch    1000000    2178 ns/op

fast path, when nothing matches:
BenchmarkByteByteNoMatch  1000000    1109 ns/op

comparisons to multiple Replace calls:
BenchmarkByteByteReplaces  100000   16164 ns/op

comparison to strings.Map:
BenchmarkByteByteMap       500000    5454 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/5175050

13 years agoruntime: fix usleep on linux/386 and re-enable parallel gc
Hector Chu [Mon, 3 Oct 2011 18:08:59 +0000 (19:08 +0100)]
runtime: fix usleep on linux/386 and re-enable parallel gc

R=golang-dev, jsing, alex.brainman, cw, rsc
CC=golang-dev
https://golang.org/cl/5166047

13 years agoruntime: implement runtime usleep for openbsd
Joel Sing [Sat, 1 Oct 2011 18:58:36 +0000 (11:58 -0700)]
runtime: implement runtime usleep for openbsd

R=golang-dev, mikioh.mikioh, hectorchu
CC=golang-dev
https://golang.org/cl/5173043

13 years agoruntime: fix map memory leak
Russ Cox [Sat, 1 Oct 2011 17:00:53 +0000 (13:00 -0400)]
runtime: fix map memory leak

The map implementation was using the C idiom of using
a pointer just past the end of its table as a limit pointer.
Unfortunately, the garbage collector sees that pointer as
pointing at the block adjacent to the map table, pinning
in memory a block that would otherwise be freed.

Fix by making limit pointer point at last valid entry, not
just past it.

Reviewed by Mike Burrows.

R=golang-dev, bradfitz, lvd, r
CC=golang-dev
https://golang.org/cl/5158045

13 years agosyscall: update multicast socket options for darwin, freebsd, linux, openbsd
Mikio Hara [Sat, 1 Oct 2011 09:45:06 +0000 (18:45 +0900)]
syscall: update multicast socket options for darwin, freebsd, linux, openbsd

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/5137042

13 years agofreebsd: Add stubs for runtime·osyield and runtime·usleep.
David Symonds [Fri, 30 Sep 2011 23:39:10 +0000 (16:39 -0700)]
freebsd: Add stubs for runtime·osyield and runtime·usleep.

These don't do anything useful; they are just here to fix the build.

R=golang-dev
TBR=r
CC=golang-dev
https://golang.org/cl/5154048

13 years agoio: rename Copyn to CopyN.
David Symonds [Fri, 30 Sep 2011 20:13:39 +0000 (13:13 -0700)]
io: rename Copyn to CopyN.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5157045

13 years agoruntime: disable parallel gc
Russ Cox [Fri, 30 Sep 2011 18:59:46 +0000 (14:59 -0400)]
runtime: disable parallel gc

Breaks on Linux/386 during parallel sync tests.

TBR=r
CC=golang-dev
https://golang.org/cl/5168044

13 years agoruntime: fix windows build
Hector Chu [Fri, 30 Sep 2011 18:33:13 +0000 (11:33 -0700)]
runtime: fix windows build

Add osyield and usleep as required by recent GC changes.

R=golang-dev, r, dsymonds, rsc, r
CC=golang-dev
https://golang.org/cl/5156042

13 years agoindex/suffixarray: 4.5x faster index serialization (to memory)
Robert Griesemer [Fri, 30 Sep 2011 18:31:28 +0000 (11:31 -0700)]
index/suffixarray: 4.5x faster index serialization (to memory)

Benchmark results (best of 3 runs):

old: suffixarray.BenchmarkSaveRestore        1 1931909000 ns/op   28.21 MB/s
new: suffixarray.BenchmarkSaveRestore        5  429721800 ns/op  117.14 MB/s

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5161043

13 years agoruntime: fix darwin build
Rob Pike [Fri, 30 Sep 2011 17:52:36 +0000 (10:52 -0700)]
runtime: fix darwin build
Add place holder for runtime.osyield.

R=golang-dev
CC=golang-dev
https://golang.org/cl/5149049

13 years agoruntime: parallelize garbage collector mark + sweep
Russ Cox [Fri, 30 Sep 2011 13:40:01 +0000 (09:40 -0400)]
runtime: parallelize garbage collector mark + sweep

Running test/garbage/parser.out.

On a 4-core Lenovo X201s (Linux):
31.12u 0.60s 31.74r   1 cpu, no atomics
32.27u 0.58s 32.86r   1 cpu, atomic instructions
33.04u 0.83s 27.47r   2 cpu

On a 16-core Xeon (Linux):
33.08u 0.65s 33.80r   1 cpu, no atomics
34.87u 1.12s 29.60r   2 cpu
36.00u 1.87s 28.43r   3 cpu
36.46u 2.34s 27.10r   4 cpu
38.28u 3.85s 26.92r   5 cpu
37.72u 5.25s 26.73r  6 cpu
39.63u 7.11s 26.95r  7 cpu
39.67u 8.10s 26.68r  8 cpu

On a 2-core MacBook Pro Core 2 Duo 2.26 (circa 2009, MacBookPro5,5):
39.43u 1.45s 41.27r   1 cpu, no atomics
43.98u 2.95s 38.69r   2 cpu

On a 2-core Mac Mini Core 2 Duo 1.83 (circa 2008; Macmini2,1):
48.81u 2.12s 51.76r   1 cpu, no atomics
57.15u 4.72s 51.54r   2 cpu

The handoff algorithm is really only good for two cores.
Beyond that we will need to so something more sophisticated,
like have each core hand off to the next one, around a circle.
Even so, the code is a good checkpoint; for now we'll limit the
number of gc procs to at most 2.

R=dvyukov
CC=golang-dev
https://golang.org/cl/4641082

13 years agoexp/template/html: avoid redundant escaping directives.
Mike Samuel [Fri, 30 Sep 2011 04:31:41 +0000 (21:31 -0700)]
exp/template/html: avoid redundant escaping directives.

This is a possible optimization.  I'm not sure the complexity is worth it.
The new benchmark in escape_test is 46us without and 35us with the optimization.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5168041

13 years agodoc: link to image/draw blog post.
Nigel Tao [Fri, 30 Sep 2011 03:11:20 +0000 (13:11 +1000)]
doc: link to image/draw blog post.

R=adg
TBR=adg
CC=golang-dev
https://golang.org/cl/5154046

13 years agoexp/template/html: simplify URL filtering
Mike Samuel [Fri, 30 Sep 2011 01:09:11 +0000 (18:09 -0700)]
exp/template/html: simplify URL filtering

This removes a few cases from escapeAction and clarifies the
responsibilities of urlFilter which no longer does any
escaping or normalization.  It is now solely a filter.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5162043

13 years agoexp/sql{,/driver}: new database packages
Brad Fitzpatrick [Thu, 29 Sep 2011 23:12:21 +0000 (16:12 -0700)]
exp/sql{,/driver}: new database packages

R=gustavo, rsc, borman, dave, kevlar, nigeltao, dvyukov, kardianos, fw, r, r, david.crawshaw
CC=golang-dev
https://golang.org/cl/4973055

13 years agoio/ioutil: add a comment on why devNull is a ReaderFrom
Brad Fitzpatrick [Thu, 29 Sep 2011 22:35:01 +0000 (15:35 -0700)]
io/ioutil: add a comment on why devNull is a ReaderFrom

... protects this optimization from future well-meaning
Gophers looking to delete unused code. :)

R=gri
CC=golang-dev
https://golang.org/cl/5165041

13 years agogo spec: remove notes about gccgo limitations, now fixed
Ian Lance Taylor [Thu, 29 Sep 2011 21:50:55 +0000 (14:50 -0700)]
go spec: remove notes about gccgo limitations, now fixed

R=gri
CC=golang-dev
https://golang.org/cl/5164041

13 years agoruntime: gdb support, fix pretty printing of channels.
Luuk van Dijk [Thu, 29 Sep 2011 19:07:38 +0000 (12:07 -0700)]
runtime: gdb support, fix pretty printing of channels.

The type to cast the elements to was stolen from a field
that's no longer there.

R=rsc
CC=golang-dev
https://golang.org/cl/5143050

13 years agofmt: replace channel cache with slice.
Rob Pike [Thu, 29 Sep 2011 18:23:06 +0000 (11:23 -0700)]
fmt: replace channel cache with slice.
Simpler concept, and it turns a queue into a stack.
Speeds up benchmarks noticeably.

Before:
fmt_test.BenchmarkSprintfEmpty 10000000        282 ns/op
fmt_test.BenchmarkSprintfString  2000000        910 ns/op
fmt_test.BenchmarkSprintfInt  5000000        723 ns/op
fmt_test.BenchmarkSprintfIntInt  1000000       1071 ns/op
fmt_test.BenchmarkSprintfPrefixedInt  1000000       1108 ns/op
fmt_test.BenchmarkScanInts     1000    2239510 ns/op
fmt_test.BenchmarkScanRecursiveInt     1000    2365432 ns/op

After:
fmt_test.BenchmarkSprintfEmpty 10000000        232 ns/op
fmt_test.BenchmarkSprintfString  2000000        837 ns/op
fmt_test.BenchmarkSprintfInt  5000000        590 ns/op
fmt_test.BenchmarkSprintfIntInt  2000000        910 ns/op
fmt_test.BenchmarkSprintfPrefixedInt  2000000        996 ns/op
fmt_test.BenchmarkScanInts     1000    2210715 ns/op
fmt_test.BenchmarkScanRecursiveInt     1000    2367800 ns/op

R=rsc, r
CC=golang-dev
https://golang.org/cl/5151044

13 years agomath: remove the leading F from Fabs etc.
Rob Pike [Thu, 29 Sep 2011 16:54:20 +0000 (09:54 -0700)]
math: remove the leading F from Fabs etc.
The letter is a holdover from C and unnecessary in Go.
Gofix module included.
Fixes #2306.

R=golang-dev, gri, dsymonds
CC=golang-dev
https://golang.org/cl/5158043

13 years agoencoding/binary: PutX functions require buffer of sufficient size.
Robert Griesemer [Thu, 29 Sep 2011 16:40:59 +0000 (09:40 -0700)]
encoding/binary: PutX functions require buffer of sufficient size.

R=rsc
CC=golang-dev
https://golang.org/cl/5163041

13 years ago5g: fix -f()
Russ Cox [Thu, 29 Sep 2011 16:09:46 +0000 (12:09 -0400)]
5g: fix -f()

R=ken2
CC=golang-dev
https://golang.org/cl/5161041

13 years agoencoding/binary: support for varint encoding
Robert Griesemer [Thu, 29 Sep 2011 05:36:52 +0000 (22:36 -0700)]
encoding/binary: support for varint encoding

R=rsc, r, nigeltao, r, dsymonds
CC=golang-dev
https://golang.org/cl/5146048

13 years agogo: skeleton implementation
Russ Cox [Thu, 29 Sep 2011 00:07:21 +0000 (20:07 -0400)]
go: skeleton implementation

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5141051

13 years agoexp/template/html: handle custom attrs and HTML5 embedded elements.
Mike Samuel [Wed, 28 Sep 2011 21:07:48 +0000 (14:07 -0700)]
exp/template/html: handle custom attrs and HTML5 embedded elements.

HTML5 allows embedded SVG and MathML.
Code searches show SVG is used for graphing.

This changes transition to deal with constructs like
   <svg xmlns:xlink="http://www.w3.org/1999/xlink">
It changes attr and clients to call a single function that combines
the name lookup and "on" prefix check to determine an attribute
value type given an attribute name.

That function uses heuristics to recognize that
     xlink:href and svg:href
have URL content, and that data-url is likely contains URL content,
since "javascript:" injection is such a problem.

I did a code search over a closure templates codebase to determine
patterns of custom attribute usage.  I did something like

$ find . -name \*.soy | \
    xargs egrep perl -ne 'while (s/\b((data-|\w+:)\w+)\s*=//) { print "$1\n"; }' | \
    sort | uniq

to produce the list at the bottom.

Filtering that by egrep -i 'src|url|uri' produces

data-docConsumptionUri
data-docIconUrl
data-launchUrl
data-lazySrc
data-pageUrl
data-shareurl
data-suggestServerUrl
data-tweetUrl
g:secondaryurls
g:url

which seem to match all the ones that are likely URL content.
There are some short words that match that heuristic, but I still think it decent since
any custom attribute that has a numeric or enumerated keyword value will be unaffected by
the URL assumption.
Counterexamples from /usr/share/dict:
during, hourly, maturity, nourish, purloin, security, surly

Custom attributes present in existing closure templates codebase:
buzz:aid
data-a
data-action
data-actor
data-allowEqualityOps
data-analyticsId
data-bid
data-c
data-cartId
data-categoryId
data-cid
data-command
data-count
data-country
data-creativeId
data-cssToken
data-dest
data-docAttribution
data-docConsumptionUri
data-docCurrencyCode
data-docIconUrl
data-docId
data-docPrice
data-docPriceMicros
data-docTitle
data-docType
data-docid
data-email
data-entityid
data-errorindex
data-f
data-feature
data-fgid
data-filter
data-fireEvent
data-followable
data-followed
data-hashChange
data-height
data-hover
data-href
data-id
data-index
data-invitable
data-isFree
data-isPurchased
data-jid
data-jumpid
data-launchUrl
data-lazySrc
data-listType
data-maxVisiblePages
data-name
data-nid
data-nodeid
data-numItems
data-numPerPage
data-offerType
data-oid
data-opUsesEquality
data-overflowclass
data-packageName
data-pageId
data-pageUrl
data-pos
data-priceBrief
data-profileIds
data-query
data-rating
data-ref
data-rentalGrantPeriodDays
data-rentalactivePeriodHours
data-reviewId
data-role
data-score
data-shareurl
data-showGeLe
data-showLineInclude
data-size
data-sortval
data-suggestServerType
data-suggestServerUrl
data-suggestionIndex
data-tabBarId
data-tabBarIndex
data-tags
data-target
data-textColor
data-theme
data-title
data-toggletarget
data-tooltip
data-trailerId
data-transactionId
data-transition
data-ts
data-tweetContent
data-tweetUrl
data-type
data-useAjax
data-value
data-width
data-x
dm:index
dm:type
g:aspects
g:decorateusingsecondary
g:em
g:entity
g:groups
g:id
g:istoplevel
g:li
g:numresults
g:oid
g:parentId
g:pl
g:pt
g:rating_override
g:secondaryurls
g:sortby
g:startindex
g:target
g:type
g:url
g:value
ga:barsize
ga:css
ga:expandAfterCharsExceed
ga:initialNumRows
ga:nocancelicon
ga:numRowsToExpandTo
ga:type
ga:unlockwhenrated
gw:address
gw:businessname
gw:comment
gw:phone
gw:source
ng:controller
xlink:href
xml:lang
xmlns:atom
xmlns:dc
xmlns:jstd
xmlns:ng
xmlns:og
xmlns:webstore
xmlns:xlink

R=nigeltao
CC=golang-dev
https://golang.org/cl/5119041

13 years agoexp/template/html: don't normalize '<' in doctypes.
Mike Samuel [Wed, 28 Sep 2011 20:32:56 +0000 (13:32 -0700)]
exp/template/html: don't normalize '<' in doctypes.

The normalization that prevents element name and comment injection in
  <{{.}}
by converting it to
  &lt;{{.}}
breaks
  <!DOCTYPE html>

Instead of splitting states to have a start of document state and a text
state, I whitelist <!DOCTYPE.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5131051

13 years agogo: documentation for new command
Russ Cox [Wed, 28 Sep 2011 20:00:12 +0000 (16:00 -0400)]
go: documentation for new command

*** This is a design review, not a code review. ***
Feel free to reply to the mail instead of picking out
individual lines to comment on in Rietveld.

This command, go, will replace both gomake/make and goinstall.
Make will stick around only for building our C commands
and perhaps package runtime.

In normal use while developing you'd run commands like

        go compile
        go test
        go clean
        go install

which apply to the package in the current directory.

To operate on code written by others, you add an explicit
package path:

        go get gopath.googlecode.com/hg/oauth
        go test gopath.googlecode.com/hg/oauth

The script.txt file is a script showing the output of
the various help commands that the command has.
(Right now, all the command can do is print help messages.)

R=golang-dev, bradfitz, kevlar, r, edsrzf, gri, adg, rogpeppe, r
CC=golang-dev
https://golang.org/cl/5019045

13 years agostrings: add Replacer, NewReplacer
Brad Fitzpatrick [Wed, 28 Sep 2011 16:34:26 +0000 (09:34 -0700)]
strings: add Replacer, NewReplacer

This is just a new API to do many replacements at once.

While the point of this API is to be faster than doing replacements one
at a time, the implementation in this CL has the optimizations removed
and may actually be slower.

Future CLs will bring back & add optimizations.

R=r, rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5081042

13 years agohttp: don't send a 400 Bad Request after a client shutdown
Brad Fitzpatrick [Wed, 28 Sep 2011 16:27:11 +0000 (09:27 -0700)]
http: don't send a 400 Bad Request after a client shutdown

Fixes #2312

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5143049

13 years agojson: use strings.EqualFold instead of strings.ToLower.
Russ Cox [Wed, 28 Sep 2011 16:00:45 +0000 (12:00 -0400)]
json: use strings.EqualFold instead of strings.ToLower.

R=golang-dev, bradfitz, iant
CC=golang-dev
https://golang.org/cl/5127043

13 years agoregexp: speedups
Russ Cox [Wed, 28 Sep 2011 16:00:31 +0000 (12:00 -0400)]
regexp: speedups

MatchEasy0_1K        500000        4207 ns/op   243.35 MB/s
MatchEasy0_1K_Old    500000        4625 ns/op   221.40 MB/s
MatchEasy0_1M           500     3948932 ns/op   265.53 MB/s
MatchEasy0_1M_Old       500     3943926 ns/op   265.87 MB/s
MatchEasy0_32K        10000      122974 ns/op   266.46 MB/s
MatchEasy0_32K_Old    10000      123270 ns/op   265.82 MB/s
MatchEasy0_32M           10   127265400 ns/op   263.66 MB/s
MatchEasy0_32M_Old       10   127123500 ns/op   263.95 MB/s
MatchEasy1_1K        500000        5637 ns/op   181.63 MB/s
MatchEasy1_1K_Old     10000      100690 ns/op    10.17 MB/s
MatchEasy1_1M           200     7683150 ns/op   136.48 MB/s
MatchEasy1_1M_Old        10   145774000 ns/op     7.19 MB/s
MatchEasy1_32K        10000      239887 ns/op   136.60 MB/s
MatchEasy1_32K_Old      500     4508182 ns/op     7.27 MB/s
MatchEasy1_32M           10   247103500 ns/op   135.79 MB/s
MatchEasy1_32M_Old        1  4660191000 ns/op     7.20 MB/s
MatchMedium_1K        10000      160567 ns/op     6.38 MB/s
MatchMedium_1K_Old    10000      158367 ns/op     6.47 MB/s
MatchMedium_1M           10   162928000 ns/op     6.44 MB/s
MatchMedium_1M_Old       10   159699200 ns/op     6.57 MB/s
MatchMedium_32K         500     5090758 ns/op     6.44 MB/s
MatchMedium_32K_Old     500     5005800 ns/op     6.55 MB/s
MatchMedium_32M           1  5233973000 ns/op     6.41 MB/s
MatchMedium_32M_Old       1  5109676000 ns/op     6.57 MB/s
MatchHard_1K          10000      249087 ns/op     4.11 MB/s
MatchHard_1K_Old       5000      364569 ns/op     2.81 MB/s
MatchHard_1M              5   256050000 ns/op     4.10 MB/s
MatchHard_1M_Old          5   372446400 ns/op     2.82 MB/s
MatchHard_32K           200     7944525 ns/op     4.12 MB/s
MatchHard_32K_Old       100    11609380 ns/op     2.82 MB/s
MatchHard_32M             1  8144503000 ns/op     4.12 MB/s
MatchHard_32M_Old         1 11885434000 ns/op     2.82 MB/s

R=r, bradfitz
CC=golang-dev
https://golang.org/cl/5134049

13 years agohgpatch: do not use hg exit status
Yasuhiro Matsumoto [Wed, 28 Sep 2011 16:00:17 +0000 (12:00 -0400)]
hgpatch: do not use hg exit status

Fixes #2243.

R=rsc
CC=golang-dev
https://golang.org/cl/5146041

13 years agonet: add shutdown: TCPConn.CloseWrite and CloseRead
Brad Fitzpatrick [Wed, 28 Sep 2011 15:12:38 +0000 (08:12 -0700)]
net: add shutdown: TCPConn.CloseWrite and CloseRead

R=golang-dev, rsc, iant
CC=golang-dev
https://golang.org/cl/5136052

13 years agoexp/template/html: do not escape the RHS of assignments
Mike Samuel [Wed, 28 Sep 2011 05:08:14 +0000 (22:08 -0700)]
exp/template/html: do not escape the RHS of assignments

In

  {{$x := . | foo}}
  {{$x}}

the first action is a variable assignment that contributes
nothing to the output while the first is a use that needs
to be escaped.

This CL fixes escapeAction to distinguish assignments from
interpolations and to only modify interpolations.

R=nigeltao, r
CC=golang-dev
https://golang.org/cl/5143048

13 years agoindex/suffixarray: revert change from int -> int32
Robert Griesemer [Tue, 27 Sep 2011 23:21:28 +0000 (16:21 -0700)]
index/suffixarray: revert change from int -> int32

CL 5040041 (https://golang.org/cl/5040041)
changed the use of []int to []int32 internally so
that encoding/binary could be used. This is no
longer needed (gobs can encode ints), and using
[]int is more in sync w/ the semantics of the data
structure (the index elements are indices which are
ints). Changing it back.

R=r
CC=golang-dev
https://golang.org/cl/5141049

13 years agoexp/template/html: add doc comments for undocumented Err... constants.
Mike Samuel [Tue, 27 Sep 2011 20:22:01 +0000 (13:22 -0700)]
exp/template/html: add doc comments for undocumented Err... constants.

Does some TODOs and changes the term "div" in an error message
to "division" to avoid confusion with "<div>".

R=nigeltao, r
CC=golang-dev
https://golang.org/cl/5141047

13 years agoexp/ssh: update tag usage to new convention.
Rob Pike [Tue, 27 Sep 2011 17:22:42 +0000 (10:22 -0700)]
exp/ssh: update tag usage to new convention.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5136047

13 years agoarchive/zip: fix Fatal call
Rob Pike [Tue, 27 Sep 2011 16:33:26 +0000 (09:33 -0700)]
archive/zip: fix Fatal call
Error found by govet.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5142048

13 years agocrypto/elliptic: use %x consistently in error print
Russ Cox [Tue, 27 Sep 2011 13:40:01 +0000 (09:40 -0400)]
crypto/elliptic: use %x consistently in error print

Fixes #2308.

R=agl, gri
CC=golang-dev
https://golang.org/cl/5121052

13 years agotest: fix windows build
Russ Cox [Tue, 27 Sep 2011 13:13:00 +0000 (09:13 -0400)]
test: fix windows build

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/5124049

13 years agoruntime: check for nil value pointer in select syncsend case
Ian Lance Taylor [Tue, 27 Sep 2011 03:46:37 +0000 (20:46 -0700)]
runtime: check for nil value pointer in select syncsend case

Fixes #2309.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5128053

13 years agoexp/norm: fix benchmark bug
Robert Griesemer [Tue, 27 Sep 2011 01:23:21 +0000 (18:23 -0700)]
exp/norm: fix benchmark bug

- don't use range over string to copy string bytes
- some code simplification

R=mpvl
CC=golang-dev
https://golang.org/cl/5144044

13 years agowebsocket: remove use of container/vector
Russ Cox [Mon, 26 Sep 2011 23:52:34 +0000 (19:52 -0400)]
websocket: remove use of container/vector

R=golang-dev, r
CC=golang-dev, ukai
https://golang.org/cl/5140046

13 years agobytes: add EqualFold
Russ Cox [Mon, 26 Sep 2011 23:35:32 +0000 (19:35 -0400)]
bytes: add EqualFold

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5123047

13 years agotest: silence/coalesce some tests
Russ Cox [Mon, 26 Sep 2011 23:35:21 +0000 (19:35 -0400)]
test: silence/coalesce some tests

Add copyright notice to nilptr.go.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5139048

13 years agogob: protect against invalid message length
Rob Pike [Mon, 26 Sep 2011 22:58:01 +0000 (15:58 -0700)]
gob: protect against invalid message length
Fixes #2301.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5134048

13 years agoregexp: move to old/regexp, replace with exp/regexp
Russ Cox [Mon, 26 Sep 2011 22:33:13 +0000 (18:33 -0400)]
regexp: move to old/regexp, replace with exp/regexp

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5127042

13 years agostrings: add EqualFold
Russ Cox [Mon, 26 Sep 2011 22:32:51 +0000 (18:32 -0400)]
strings: add EqualFold

Case-insensitive strcmp without using ToLower.
(Using ToLower is not always correct, and it allocates.)

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5143044

13 years agocodereview: extra repo sanity check
Russ Cox [Mon, 26 Sep 2011 22:32:16 +0000 (18:32 -0400)]
codereview: extra repo sanity check

Also work around Mercurial issue 3023.

If anyone has local changes in their repo (due to
patch queues or whatever) stop them from leaking
into the main repository.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5144043

13 years agostrconv: faster Unquote in common case
Russ Cox [Mon, 26 Sep 2011 17:59:12 +0000 (13:59 -0400)]
strconv: faster Unquote in common case

Also reject literal newline in " and ' quoted strings.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5139045

13 years agotest: merge nilptr/* into one test
Russ Cox [Mon, 26 Sep 2011 17:59:01 +0000 (13:59 -0400)]
test: merge nilptr/* into one test

The 512 MB array causes load delays on some systems.
Now that we have recover, we can do all the tests in
one binary, so that the delay is incurred just once.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5142044

13 years agotest: disable sigchld test on Windows
Russ Cox [Mon, 26 Sep 2011 17:11:22 +0000 (13:11 -0400)]
test: disable sigchld test on Windows

Alex Brainman reports that this is the only test
that keeps us from running test/run.

R=alex.brainman, lucio.dere, bradfitz, hectorchu
CC=golang-dev
https://golang.org/cl/4777043

13 years agounicode: fix make tables
Russ Cox [Mon, 26 Sep 2011 17:10:16 +0000 (13:10 -0400)]
unicode: fix make tables

R=r
CC=golang-dev
https://golang.org/cl/5131044

13 years agodoc: fix memory model read visibility bug
Russ Cox [Mon, 26 Sep 2011 16:54:30 +0000 (12:54 -0400)]
doc: fix memory model read visibility bug

Fixes #2277.

R=dvyukov, r
CC=golang-dev
https://golang.org/cl/5083044

13 years agoexp/ssh: move common code to common.go
Dave Cheney [Mon, 26 Sep 2011 14:25:13 +0000 (10:25 -0400)]
exp/ssh: move common code to common.go

R=agl
CC=golang-dev
https://golang.org/cl/5132041

13 years agoexp/template/html: make sure marshalled JSON can be parsed as JS.
Mike Samuel [Mon, 26 Sep 2011 09:10:43 +0000 (02:10 -0700)]
exp/template/html: make sure marshalled JSON can be parsed as JS.

This makes sure that all JS newlines are encoded in JSON.

It also moots a TODO about possibly escaping supplemental codepoints.
I served:

Content-Type: text/javascript;charset=UTF-8

var s = "%s";
document.write("<p>", s, "</p><ol>");
for (var i = 0; i < s.length; i++) {
  document.write("<li>", s.charCodeAt(i).toString(16), "</li>");
}
document.write("</l>");

where %s was replaced with bytes "\xf0\x9d\x84\x9e" to test
straight UTF-8 instead of encoding surrogates separately.

Recent Firefox, Chrome, and Safari all decoded it properly.
I have yet to try it on IE or older versions.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5129042

13 years agoexp/template/html: fix infinite loop in escapeText on bad input
Mike Samuel [Mon, 26 Sep 2011 07:56:49 +0000 (00:56 -0700)]
exp/template/html: fix infinite loop in escapeText on bad input

The template
    "<a="
caused an infinite loop in escape text.

The change to tTag fixes that and the change to escape.go causes
escapeText to panic on any infinite loop that does not involve
a state cycle.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5115041

13 years agoexp/template/html: error out on ambiguous unquoted attributes
Mike Samuel [Mon, 26 Sep 2011 07:42:38 +0000 (00:42 -0700)]
exp/template/html: error out on ambiguous unquoted attributes

HTML parsers may differ on whether
<input id= onchange=f(             ends in id's or onchange's value,
<a class=`foo                      ends inside a value,
<input style=font:'Arial'          needs open-quote fixup.

Per
http://www.w3.org/TR/html5/tokenization.html#attribute-value-unquoted-state
this treats the error cases in 8.2.4.40 Attribute value (unquoted) state
as fatal errors.

\> U+0022 QUOTATION MARK (")
\> U+0027 APOSTROPHE (')
\> U+003C LESS-THAN SIGN (<)
\> U+003D EQUALS SIGN (=)
\> U+0060 GRAVE ACCENT (`)
        Parse error. Treat it as per the "anything else" entry below.

and emits ErrBadHTML.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5085050

13 years agoexp/template/html: remove TODO comments that have been done or mooted
Mike Samuel [Mon, 26 Sep 2011 07:10:21 +0000 (00:10 -0700)]
exp/template/html: remove TODO comments that have been done or mooted

R=nigeltao
CC=golang-dev
https://golang.org/cl/5128041

13 years agoarchive/zip: read and write unix file modes
Gustavo Niemeyer [Sun, 25 Sep 2011 23:48:03 +0000 (20:48 -0300)]
archive/zip: read and write unix file modes

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/5124044

13 years agorpc: fix typo in documentation client example
David G. Andersen [Sun, 25 Sep 2011 04:19:08 +0000 (14:19 +1000)]
rpc:  fix typo in documentation client example
The example incorrectly dereferenced an integer variable

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5129041

13 years agotest: match gccgo error messages
Ian Lance Taylor [Sat, 24 Sep 2011 04:23:40 +0000 (21:23 -0700)]
test: match gccgo error messages

bug340.go:14:7: error: expected type
bug340.go:15:4: error: reference to undefined field or method ‘x’

bug350.go:12:1: error: redefinition of ‘m’
bug350.go:11:1: note: previous definition of ‘m’ was here
bug350.go:15:1: error: redefinition of ‘p’
bug350.go:14:1: note: previous definition of ‘p’ was here

bug351.go:12:6: error: non-name on left side of ‘:=’

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5127041

13 years agosyscall: mksyscall_windows.pl to produce packages other than syscall (for example...
Jaroslavas Počepko [Sat, 24 Sep 2011 00:38:39 +0000 (10:38 +1000)]
syscall: mksyscall_windows.pl to produce packages other than syscall (for example pkg/exp/wingui/zwinapi.go)

R=golang-dev, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/4964074

13 years agohttp: add Location method to Response
Brad Fitzpatrick [Fri, 23 Sep 2011 17:57:31 +0000 (10:57 -0700)]
http: add Location method to Response

Fixes #2300

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5117041

13 years agoexp/template/html: tighten rules on dynamic attr names.
Mike Samuel [Fri, 23 Sep 2011 16:25:10 +0000 (09:25 -0700)]
exp/template/html: tighten rules on dynamic attr names.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5076049

13 years agosuffixarray: add benchmarks for construction
Eric Eisner [Fri, 23 Sep 2011 16:18:10 +0000 (09:18 -0700)]
suffixarray: add benchmarks for construction

R=gri, jeff
CC=golang-dev
https://golang.org/cl/5040048

13 years agosyscall: add GetsockoptByte, SetsockoptByte for openbsd
Mikio Hara [Fri, 23 Sep 2011 14:39:19 +0000 (23:39 +0900)]
syscall: add GetsockoptByte, SetsockoptByte for openbsd

R=golang-dev, fullung, dave, rsc
CC=golang-dev
https://golang.org/cl/5081044

13 years agosyscall: add IPv4 ancillary data for linux
Mikio Hara [Fri, 23 Sep 2011 14:38:52 +0000 (23:38 +0900)]
syscall: add IPv4 ancillary data for linux

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5039042

13 years agonet: make use of AF_UNSPEC instead of individual address family
Mikio Hara [Fri, 23 Sep 2011 14:37:42 +0000 (23:37 +0900)]
net: make use of AF_UNSPEC instead of individual address family

R=fullung, rsc
CC=golang-dev
https://golang.org/cl/5034044

13 years agoruntime: gdb support: gracefully handle not being able to find types
Luuk van Dijk [Fri, 23 Sep 2011 08:28:02 +0000 (10:28 +0200)]
runtime: gdb support: gracefully handle not being able to find types

The Dwarf info has the full typenames, the go *struct runtime.commonType
has the short name.  A more permanent fix would link the two together
but this way the user gets useable stack traces for now.

R=rsc
CC=golang-dev
https://golang.org/cl/5097046

13 years agosyscall: mark stdin, stdout and stderr as non-inheritable by child process
Alex Brainman [Fri, 23 Sep 2011 08:16:13 +0000 (18:16 +1000)]
syscall: mark stdin, stdout and stderr as non-inheritable by child process

Fixes #2250.

R=golang-dev, hectorchu
CC=golang-dev, vincent.vanackere
https://golang.org/cl/5086050

13 years agowebsocket: add mutex to make websocket full-duplex
Fumitoshi Ukai [Fri, 23 Sep 2011 01:49:24 +0000 (21:49 -0400)]
websocket: add mutex to make websocket full-duplex

One benefit of websocket is that it is full-duplex so that it could
send and receive at the same time.
This CL makes websocket goroutine safe, so user could use websocket
both on goroutine for read and on goroutine for write.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5058043

13 years agovim: Send GoFmt errors to a location list
Paul Sbarra [Thu, 22 Sep 2011 23:38:10 +0000 (09:38 +1000)]
vim: Send GoFmt errors to a location list

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5043046

13 years agodoc: link to image blog post
Andrew Gerrand [Thu, 22 Sep 2011 21:22:28 +0000 (07:22 +1000)]
doc: link to image blog post

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5086048

13 years agotag weekly.2011-09-21
Andrew Gerrand [Thu, 22 Sep 2011 05:08:23 +0000 (15:08 +1000)]
tag weekly.2011-09-21

R=dsymonds
CC=golang-dev
https://golang.org/cl/5086049

13 years agoweekly.2011-09-21 weekly.2011-09-21
Andrew Gerrand [Thu, 22 Sep 2011 05:06:10 +0000 (15:06 +1000)]
weekly.2011-09-21

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5075050

13 years agoexp/template/html: elide comments in template source.
Mike Samuel [Thu, 22 Sep 2011 04:38:40 +0000 (21:38 -0700)]
exp/template/html: elide comments in template source.

When templates are stored in external files, developers often embed
comments to explain&|disable code.

  <!-- Oblique reference to project code name here -->
  {{if .C}}...{{else}}<!-- commented out default -->{{end}}

This unnecessarily increases the size of shipped HTML and can leak
information.

This change elides all comments of the following types:
1. <!-- ... --> comments found in source.
2. /*...*/ and // comments found in <script> elements.
3. /*...*/ and // comments found in <style> elements.

It does not elide /*...*/ or // comments found in HTML attributes:
4. <button onclick="/*...*/">
5. <div style="/*...*/">

I can find no examples of comments in attributes in Closure Templates
code and doing so would require keeping track of character positions
post decode in

  <button onclick="/&#42;...*/">

To prevent token joining, /*comments*/ are JS and CSS comments are
replaced with a whitespace char.
HTML comments are not, but to prevent token joining we could try to
detect cases like
   <<!---->b>
   </<!---->b>
which has a well defined meaning in HTML but will cause a validator
to barf.  This is difficult, and this is a very minor case.
I have punted for now, but if we need to address this case, the best
way would be to normalize '<' in stateText to '&lt;' consistently.

The whitespace to replace a JS /*comment*/ with depends on whether
there is an embedded line terminator since
    break/*
    */foo
    ...
is equivalent to
    break;
    foo
    ...
while
    break/**/foo
    ...
is equivalent to
    break foo;
    ...

Comment eliding can interfere with IE conditional comments.
http://en.wikipedia.org/wiki/Conditional_comment

<!--[if IE 6]>
<p>You are using Internet Explorer 6.</p>
<![endif]-->

/*@cc_on
  document.write("You are using IE4 or higher");
@*/

I have not encountered these in production template code, and
the typed content change in CL 4962067 provides an escape-hatch
if conditional comments are needed.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4999042

13 years agoA&C: Add Paul Sbarra.
David Symonds [Thu, 22 Sep 2011 03:05:13 +0000 (13:05 +1000)]
A&C: Add Paul Sbarra.

R=golang-dev, adg
CC=golang-dev, sbarra.paul
https://golang.org/cl/5044045

13 years agoexp/template/html: simplify transition functions
Mike Samuel [Thu, 22 Sep 2011 02:04:41 +0000 (19:04 -0700)]
exp/template/html: simplify transition functions

This simplifies transition functions to make it easier to reliably
elide comments in a later CL.

Before:
- transition functions are responsible for detecting special end tags.
After:
- the code to detect special end tags is done in one place.

We were relying on end tags being skipped which meant we were
not noticing comments inside script/style elements that contain no
substitutions.
This change means we will notice all such comments where necessary,
but stripTags will notice none since it does not need to.  This speeds
up stripTags.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5074041

13 years agotest: match gccgo error messages
Ian Lance Taylor [Thu, 22 Sep 2011 00:25:48 +0000 (17:25 -0700)]
test: match gccgo error messages

bug363.go:13:12: error: invalid context-determined non-integer type for shift operand
bug363.go:16:12: error: invalid context-determined non-integer type for shift operand

pointer.go:34:6: error: incompatible type in initialization (pointer to interface type has no methods)
pointer.go:36:6: error: incompatible type in initialization

method2.go:15:1: error: invalid pointer or interface receiver type
method2.go:16:1: error: invalid pointer or interface receiver type
method2.go:21:1: error: invalid pointer or interface receiver type
method2.go:22:1: error: invalid pointer or interface receiver type
method2.go:28:15: error: type ‘*Val’ has no method ‘val’
method2.go:33:11: error: reference to undefined field or method ‘val’

shift1.go:19:16: error: invalid context-determined non-integer type for shift operand
shift1.go:24:19: error: invalid context-determined non-integer type for shift operand
shift1.go:25:17: error: invalid context-determined non-integer type for shift operand
shift1.go:18:18: error: shift of non-integer operand
shift1.go:26:13: error: floating point constant truncated to integer
shift1.go:33:15: error: integer constant overflow
shift1.go:34:15: error: integer constant overflow
shift1.go:35:17: error: integer constant overflow

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5081051

13 years agogodoc: simplify internal FileSystem interface
Robert Griesemer [Wed, 21 Sep 2011 22:12:06 +0000 (15:12 -0700)]
godoc: simplify internal FileSystem interface

- also fixed bug: ReadFile never closed the file before
- per suggestion by bradfitz

R=bradfitz
CC=golang-dev
https://golang.org/cl/5092047

13 years agogob: slightly simpler decodeUint
Robert Griesemer [Wed, 21 Sep 2011 21:47:00 +0000 (14:47 -0700)]
gob: slightly simpler decodeUint

R=r
CC=golang-dev
https://golang.org/cl/5089048

13 years agogob: slightly simpler code for encodeUint
Robert Griesemer [Wed, 21 Sep 2011 21:18:48 +0000 (14:18 -0700)]
gob: slightly simpler code for encodeUint

R=r
CC=golang-dev
https://golang.org/cl/5077047

13 years agobytes: fix Replace so it actually copies
Gustavo Niemeyer [Wed, 21 Sep 2011 15:36:17 +0000 (12:36 -0300)]
bytes: fix Replace so it actually copies

The documentation for bytes.Replace says it copies
the slice but it won't necessarily copy them.  Since
the data is mutable, breaking the contract is an issue.

We either have to fix this by making the copy at all
times, as suggested in this CL, or we should change the
documentation and perhaps make better use of the fact
it's fine to mutate the slice in place otherwise.

R=golang-dev, bradfitz, adg, rsc
CC=golang-dev
https://golang.org/cl/5081043

13 years agohttp: add a (disabled) test for TLS handshake timeouts
Brad Fitzpatrick [Wed, 21 Sep 2011 15:30:47 +0000 (08:30 -0700)]
http: add a (disabled) test for TLS handshake timeouts

It's currently broken and disabled, pending a fix
for Issue 2281.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5092045

13 years agoexp/template/html: fix bug, '<' normalization for text nodes that change context
Mike Samuel [Wed, 21 Sep 2011 05:55:14 +0000 (22:55 -0700)]
exp/template/html: fix bug, '<' normalization for text nodes that change context

R=nigeltao
CC=golang-dev
https://golang.org/cl/5080042

13 years agotest: match gccgo error messages
Ian Lance Taylor [Tue, 20 Sep 2011 23:47:17 +0000 (16:47 -0700)]
test: match gccgo error messages

Added a return to bug357.go to avoid an error which gccgo
reports but 6g does not.

bug353.go:16:14: error: reference to undefined identifer ‘io.ReadWriterCloser’

bug357.go:18:2: error: value computed is not used

bug358.go:14:11: error: imported and not used: ioutil
bug358.go:19:9: error: invalid use of type

bug359.go:25:14: error: redefinition of ‘a’
bug359.go:25:6: note: previous definition of ‘a’ was here
bug359.go:19:6: error: incompatible type in initialization (implicit assignment of ‘list.List’ hidden field ‘front’)

bug362.go:13:6: error: iota is only defined in const declarations
bug362.go:14:6: error: iota is only defined in const declarations
bug362.go:15:6: error: iota is only defined in const declarations

bug363.go:13:12: error: shift of non-integer operand
bug363.go:16:12: error: shift of non-integer operand

bug365.go:15:8: error: expected package

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5078046

13 years agotest: match gccgo error messages for bug349.go
Ian Lance Taylor [Tue, 20 Sep 2011 21:47:48 +0000 (14:47 -0700)]
test: match gccgo error messages for bug349.go

bug349.go:12:14: error: expected ‘;’ or ‘}’ or newline
bug349.go:12:2: error: not enough arguments to return

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5081047

13 years agotest: match gccgo error messages for goto.go and bug344.go
Ian Lance Taylor [Tue, 20 Sep 2011 21:45:54 +0000 (14:45 -0700)]
test: match gccgo error messages for goto.go and bug344.go

goto.go:39:2: error: goto jumps over declaration of ‘x’
goto.go:40:2: note: ‘x’ defined here
goto.go:57:2: error: goto jumps over declaration of ‘x’
goto.go:62:2: note: ‘x’ defined here
goto.go:77:2: error: goto jumps over declaration of ‘x’
goto.go:78:2: note: ‘x’ defined here
goto.go:87:2: error: goto jumps over declaration of ‘x’
goto.go:88:2: note: ‘x’ defined here
goto.go:114:2: error: goto jumps into block
goto.go:115:2: note: goto target block starts here
goto.go:125:2: error: goto jumps into block
goto.go:122:2: note: goto target block starts here
goto.go:130:2: error: goto jumps into block
goto.go:133:4: note: goto target block starts here
goto.go:142:2: error: goto jumps into block
goto.go:145:2: note: goto target block starts here
goto.go:179:2: error: goto jumps into block
goto.go:180:10: note: goto target block starts here
goto.go:186:2: error: goto jumps into block
goto.go:187:10: note: goto target block starts here
goto.go:194:2: error: goto jumps into block
goto.go:196:4: note: goto target block starts here
goto.go:205:3: error: goto jumps into block
goto.go:202:11: note: goto target block starts here
goto.go:211:3: error: goto jumps into block
goto.go:212:4: note: goto target block starts here
goto.go:219:3: error: goto jumps into block
goto.go:220:18: note: goto target block starts here
goto.go:227:3: error: goto jumps into block
goto.go:228:18: note: goto target block starts here
goto.go:241:3: error: goto jumps into block
goto.go:243:4: note: goto target block starts here
goto.go:290:2: error: goto jumps into block
goto.go:287:6: note: goto target block starts here
goto.go:299:2: error: goto jumps into block
goto.go:294:6: note: goto target block starts here
goto.go:306:2: error: goto jumps into block
goto.go:303:12: note: goto target block starts here
goto.go:313:2: error: goto jumps into block
goto.go:310:24: note: goto target block starts here
goto.go:320:2: error: goto jumps into block
goto.go:317:18: note: goto target block starts here
goto.go:327:2: error: goto jumps into block
goto.go:324:18: note: goto target block starts here
goto.go:334:2: error: goto jumps into block
goto.go:331:18: note: goto target block starts here
goto.go:341:2: error: goto jumps into block
goto.go:338:18: note: goto target block starts here
goto.go:395:2: error: goto jumps into block
goto.go:398:2: note: goto target block starts here
goto.go:403:2: error: goto jumps into block
goto.go:406:2: note: goto target block starts here
goto.go:413:2: error: goto jumps into block
goto.go:417:2: note: goto target block starts here
goto.go:424:3: error: goto jumps into block
goto.go:426:2: note: goto target block starts here
goto.go:436:3: error: goto jumps into block
goto.go:433:2: note: goto target block starts here
goto.go:492:2: error: goto jumps into block
goto.go:495:2: note: goto target block starts here
goto.go:500:2: error: goto jumps into block
goto.go:503:2: note: goto target block starts here
goto.go:510:2: error: goto jumps into block
goto.go:514:2: note: goto target block starts here
goto.go:521:3: error: goto jumps into block
goto.go:523:2: note: goto target block starts here
goto.go:533:3: error: goto jumps into block
goto.go:530:2: note: goto target block starts here

bug344.go:17:2: error: goto jumps into block
bug344.go:20:21: note: goto target block starts here

R=rsc
CC=golang-dev
https://golang.org/cl/5077044

13 years agosuffixarray: improved serialization code
Robert Griesemer [Tue, 20 Sep 2011 21:36:19 +0000 (14:36 -0700)]
suffixarray: improved serialization code

Use gobs to serialize indexes instead of encoding/binary.

Even with gobs, serialize data in slices instead of
applying gob to the entire data structure at once,
to reduce the amount of extra buffer memory needed
inside gob.

7x faster Write/Read for new BenchmarkSaveRestore
compared to old code; possibly because encoding/binary
is more expensive for int32 slice elements (interface
call to get little/big endian encoding), while gob's
encoding is fixed (unconfirmed).

new (using gobs):
suffixarray.BenchmarkSaveRestore        1 2153604000 ns/op

old (using encoding/binary):
suffixarray.BenchmarkSaveRestore        1 15118322000 ns/op

The actual serialized data is slightly larger then using
the old code for very large indices because full 32bit indices
require 5bytes using gobs instead of 4bytes (encoding/binary)
in serialized form.

R=r
CC=golang-dev
https://golang.org/cl/5087041

13 years agoreflect: add comment about the doubled semantics of Value.String.
Rob Pike [Tue, 20 Sep 2011 20:26:57 +0000 (13:26 -0700)]
reflect: add comment about the doubled semantics of Value.String.

R=rsc
CC=golang-dev
https://golang.org/cl/5091044

13 years agohttptest: add NewUnstartedServer
Brad Fitzpatrick [Tue, 20 Sep 2011 20:02:10 +0000 (13:02 -0700)]
httptest: add NewUnstartedServer

This allows testing TLS with different http.Server
options (timeouts, limits).

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5094043