A FlagSet is an independent set of flags that may be used,
for example, to provide flag processing for subcommands
in a CLI. The standard, os.Args-derived set of flags is a
global but non-exported FlagSet and the standard functions
are wrappers for methods of that FlagSet.
Allow the programmer to control whether the program
exits if there is a parse error. For the default set, the behavior
remains to exit on error.
The handling of Usage is odd due to backward compatibility.
R=golang-dev, bradfitz, r, bradfitz
CC=golang-dev
https://golang.org/cl/4517092
A user pointed out that Go didn't work with their
corp proxy, always throwing 400 Bad Request errors.
Looking at the RFC 2616, Host is always required,
even with proxies.
The old code assumed that writing an absolute URL
in the first line of an HTTP request implied
that the Host header was no longer necessary.
Double-checked behavior with curl.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4539075
Initially I wanted to minimise dependencies but it's become clear that
big int support in ASN.1 is a common need and that it should be part
of the core.
R=bradfitz
CC=golang-dev
https://golang.org/cl/4550063
This change adds a function for generating new Entities and inchoate
support for reserialising Entities.
R=bradfitz, r, bradfitz
CC=golang-dev
https://golang.org/cl/4551044
This appears to have been a long-standing formatting bug.
The test cases has misformatted golden files.
Applied gofmt -w src misc .
Fixes#1839.
R=iant
CC=golang-dev
https://golang.org/cl/4515113
This enables customizing the behavior of formatters
with logic such as {"template"|import} or even
{Field1 Field2 "%.2f 0x%X"|printf}
Thanks to Roger Peppe for some debate on this.
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/4536059
It's documented as such, but it was never wired up
after Transport went in and Head was fixed.
If people don't want redirects, that's what RoundTripper/
Transport are for. Or a custom redirect policy.
R=golang-dev, kevlar
CC=golang-dev
https://golang.org/cl/4526065
- add Data field to ast.Object
- for package objects, the Data field holds the package scope
- resolve several TODOs
R=rsc
CC=golang-dev
https://golang.org/cl/4538069
When GOMAXPROCS>1, the testing framework runs in parallel with the
test itself and may do a small number of allocations, so allow the
"noAllocs" condition to admit just a few.
Fixes#1782.
R=rsc
CC=golang-dev, rsc
https://golang.org/cl/4533041
The code for converting negative floats was
incorrectly loading an FP control word from
the stack without ever having stored it there.
Thanks to Lars Pensjö for reporting this bug.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4515091
This CL will help to make an adaptive address family
selection possible when an any address family, vague
network string such as "ip", "tcp" or "udp" is passed
to Dial and Listen API.
Fixes#1769.
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4438066
Not sure why this only broke Windows. Make test is only run
on windows for that directory?
TBR=golang-dev
R=golang-dev
CC=golang-dev
https://golang.org/cl/4545044
The position (type) for which the "invalid cycle" error
message is reported depends on which type in a cycle of
types is first checked. Which one is first depends on
the iteration order of maps which is different on
different platforms. For now, disable this error message.
R=rsc
CC=golang-dev
https://golang.org/cl/4527059
At the moment types.Check() only deals with global
types and only partially so. But the framework is
there to compute them and check for cycles. An initial
type test is passing.
First step of a series of CLs to come.
R=rsc
CC=golang-dev
https://golang.org/cl/4425063
HEAD requests should in my opinion have the ability to follow redirects
like the implementation of GET requests does. My use case is polling
several thousand severs to check if they respond with 200 status codes.
Using GET requests is neither efficient in running time of the task nor
for bandwidth consumption.
This suggested patch changes the return signature of http.Head() to match
that of http.Get(), providing the final URL in a redirect chain.
`curl -IL http://google.com` follows redirects with HEAD requests just fine.
Fixes#1806.
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4517058
This CL:
-- removes Response.RequestMethod string
-- adds Response.Request *Request
-- removes the finalURL result parameter from client.Get()
-- adds a gofix rule for callers of http.Get which assign
the final url to the blank identifier; warning otherwise
Caller who did:
res, finalURL, err := http.Get(...)
now need to do:
res, err := http.Get(...)
if err != nil {
...
}
finalURL := res.Request.URL.String()
R=rsc
CC=golang-dev
https://golang.org/cl/4535056
The TIFF spec says that a baseline TIFF reader must gracefully terminate
when the image has a SampleFormat tag which it does not support.
For baseline compatibility, only SampleFormat=1 (the default) is needed.
Images with other sample formats (e.g. floating-point color values)
are very rare in practice.
R=nigeltao
CC=golang-dev
https://golang.org/cl/4515073
A struct or interface type node is marked incomplete if fields or
methods have been removed through any kind of filtering, not just
because entries are not exported.
The current message was misleading in some cases (for instance:
"godoc -src reflect Implements").
This CL requires CL 4527050 .
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/4529054
Partially revert CL 4518050. In go/doc.go, instead of calling the go/ast filter
functions, implement the corresponding match functions that do no remove
declaration elements.
Fixes#1803.
R=rsc
CC=golang-dev
https://golang.org/cl/4517055
This was causing a panic in the reflect package
since type.* pointers with their low bits set are
assumed to have certain flags set that disallow
the use of reflection.
Thanks to Pavel and Taru for help tracking down
this bug.
R=rsc, paulzhol, taruti
CC=golang-dev
https://golang.org/cl/4511041
There were a couple issues:
-- HEAD requests were attempting to be ungzipped,
despite having no content. That was fixed in
the previous patch version, but ultimately was
fixed as a result of other refactoring:
-- persist.go's ClientConn "lastbody" field was
remembering the wrong body, since we were
mucking with it later. Instead, ditch
ClientConn's readRes func field and add a new
method passing it in, so we can use a closure
and do all our bodyEOFSignal + gunzip stuff
in one place, simplifying a lot of code and
not requiring messing with ClientConn's innards.
-- closing the gzip reader didn't consume its
contents. if the caller wasn't done reading
all the response body and ClientConn closed it
(thinking it'd move past those bytes in the
TCP stream), it actually wouldn't. so introduce
a new wrapper just for gzip reader to have its
Close method do an ioutil.Discard on its body
first, before the close.
Fixes#1725Fixes#1804
R=rsc, eivind
CC=golang-dev
https://golang.org/cl/4523058
RFC 6265 requires that user agents MUST NOT send more than
one Cookie header in a request.
Note, this change also fixes an issue when sending requests
with more than one cookie header line to a php script served
by an apache web server. Apache concatenates the cookies
with ", ", but php tries to split them only at ";". E.g.
two cookies: "a=b, c=d" are seen by php as one cookie "a"
with the value "b, c=d".
Fixes#1801
R=bradfitz
CC=golang-dev
https://golang.org/cl/4535048
An optimization in Transport which re-uses TCP
connections early in the case where there is
no response body interacted poorly with
ErrBodyReadAfterClose. Upon recycling the TCP
connection early we would Close the Response.Body
(in case the user forgot to), but in the case
of a zero-lengthed body, the user's handler might
not have run yet.
This CL makes sure the Transport doesn't try
to Close requests when we're about to immediately
re-use the TCP connection.
This also includes additional tests I wrote
while debugging.
R=rsc, bradfitzgoog
CC=golang-dev
https://golang.org/cl/4529050
crl parses CRLs and exposes their details. In the future, Verify
should be able to use this for revocation checking.
R=bradfitz
CC=golang-dev
https://golang.org/cl/4485045
So far, only top-level names where considered when trimming ASTs
using a filter function. For instance, "godoc reflect Implements"
didn't show the "Implements" method of the type Interface because
the local method name was not considered (on the other hand, "top-
level" declared methods associated with types were considered).
With this CL, AST filter functions look also at struct fields
and interface methods.
R=rsc, r
CC=golang-dev
https://golang.org/cl/4518050
writing the idct result directly to the image buffer instead of
storing it in an intermediate d.blocks field.
Writing to d.blocks was necessary when decoding to an image.RGBA image,
but now that we decode to a ycbcr.YCbCr we can write each component
directly to the image buffer.
Crude "time ./6.out" scores to decode a specific 2592x1944 JPEG 20
times show a 16% speed-up:
BEFORE
user 0m10.410s
user 0m10.400s
user 0m10.480s
user 0m10.480s
user 0m10.460s
AFTER
user 0m9.050s
user 0m9.050s
user 0m9.050s
user 0m9.070s
user 0m9.020s
R=r
CC=golang-dev
https://golang.org/cl/4523052
When traversing parameter lists (e.g. for type checking), we want the
invariant that all identifers have associated objects (even _ idents),
so that we can associate a type with each object.
R=rsc
CC=golang-dev
https://golang.org/cl/4490042
At least, as I understand it. The spec is unclear about what happens
with a local color map.
R=nigeltao, r2
CC=golang-dev
https://golang.org/cl/4515045
This change fixes generation of "shadow" variables for bool parameters.
Before the change, it was naming all bool variables with the same name of _p0.
Now it calls them _p0, _p1, ... So the code could compile.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4479047
It's incomplete but sufficient to decode 8-bit GIFs without interlacing
or transparency. More to come.
I'll put in more tests as the feature set grows.
R=nigeltao, r2
CC=golang-dev
https://golang.org/cl/4522041
This means that the -x flag can work, which could enable
support for other languages (e.g. objective-C).
R=iant, rsc
CC=golang-dev
https://golang.org/cl/4476049
The current iteration can decode 8-bit images in
grayscale, paletted, RGB, RGBA and NRGBA mode. LZW compression
is implemented but does not work on my test images.
Deflate (i.e. zlib) compression with or without a horizontal
predictor is supported.
R=nigeltao, nigeltao_gnome
CC=golang-dev, mpl
https://golang.org/cl/4240051
Encoder now writes tRNS chunk for non-opaque paletted images.
CL includes new test images (basn3a08-trns.[ps]ng).
R=nigeltao, rsc, r
CC=golang-dev
https://golang.org/cl/4432078
On my laptop, I had an 800x600 jpeg and an 800x600 png (with
transparency). I timed how long it took to draw each image onto an
equivalently sized, zeroed RGBA image.
Previously, the jpeg took 75ms and the png took 70ms, going through
the medium-fast path, i.e. func drawRGBA in draw.go.
After this CL, the jpeg took 14ms, and the png took 21ms with the
Over operator and 12ms with the Src operator.
It's only a rough estimate basd on one image file, but it should
give an idea of the order of magnitude of improvement.
R=rsc, r
CC=adg, golang-dev
https://golang.org/cl/4468044
- added a cache for last file looked up: avoids binary
search if the file matches
- don't look up extra line info if not present
(it is almost never present)
- inline one critical binary search call (inlining
provides almost 30% improvement in this case)
Together, these changes make the go/printer benchmark
more than twice as fast (53% improvement). gofmt also
sped up by about the same amount.
Also: removed an unused internal field from FileSet.
Measurements (always best of 5 runs):
* original:
printer.BenchmarkPrint 5 238354200 ns/op (100%)
* using last file cache:
printer.BenchmarkPrint 10 201796600 ns/op (85%)
* avoiding lookup of extra line info:
printer.BenchmarkPrint 10 157072700 ns/op (66%)
* inlining a critical binary search call:
printer.BenchmarkPrint 10 111523500 ns/op (47%)
gofmt (always best of 3 runs):
* before:
time gofmt -l src misc
real 0m33.316s
user 0m31.298s
sys 0m0.319s
* after:
time gofmt -l src misc
real 0m15.889s
user 0m14.596s
sys 0m0.224s
R=r, dfc, bradfitz, rsc1
CC=golang-dev
https://golang.org/cl/4433086
Uses of $INCLUDE and $NPROC are left over from Plan 9.
Remove them to avoid causing confusion.
R=golang-dev, r2
CC=golang-dev
https://golang.org/cl/4445079
Works around bug in kernel implementation on old ARM5 kernels.
Bug was fixed on 26 Nov 2007 (between 2.6.23 and 2.6.24) but
old kernels persist.
Fixes#1750.
R=dfc, golang-dev
CC=golang-dev
https://golang.org/cl/4436072
Avoids image.At(), color.RGBA(), opposing 8 bit shifts,
and min function calls in a loop. Not as pretty as before,
but the pure version is still there to revert back to
later if/when the compiler gets better.
before (best of 5)
jpeg.BenchmarkEncodeRGBOpaque 50 64781360 ns/op 18.97 MB/s
after (best of 5)
jpeg.BenchmarkEncodeRGBOpaque 50 42044300 ns/op 29.23 MB/s
(benchmarked on an HP z600; 16 core Xeon E5520 @ 2.27Ghz)
R=r, r2, nigeltao
CC=golang-dev
https://golang.org/cl/4433088