1
0
mirror of https://github.com/golang/go synced 2024-09-25 13:20:13 -06:00
Commit Graph

15314 Commits

Author SHA1 Message Date
Robert Griesemer
3ee87d02b0 cmd/godoc: use go/build to determine package and example files
Also:
- faster code for example extraction
- simplify handling of command documentation:
  all "main" packages are treated as commands
- various minor cleanups along the way

For commands written in Go, any doc.go file containing
documentation must now be part of package main (rather
then package documentation), otherwise the documentation
won't show up in godoc (it will still build, though).

For commands written in C, documentation may still be
in doc.go files defining package documentation, but the
recommended way is to explicitly ignore those files with
a +build ignore constraint to define package main.

Fixes #4806.

R=adg, rsc, dave, bradfitz
CC=golang-dev
https://golang.org/cl/7333046
2013-02-19 11:19:58 -08:00
Kamil Kisiel
0456729977 path/filepath: add examples for SplitList and Rel.
R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/7291043
2013-02-19 10:41:35 -08:00
Russ Cox
6df181a7f0 path/filepath: document Dir better
This comment matches the one in path.

Fixes #4837.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7305100
2013-02-19 13:24:03 -05:00
Andrew Wilkins
1fe8fdf708 go/types: Use left-hand side's type as hint for right-hand
side expression evaluation in assignment operations.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/7349046
2013-02-19 09:20:56 -08:00
Robin Eklind
7fdaec6c2f debug/dwarf: add flag_present attribute encoding.
ref: http://www.dwarfstd.org/doc/DWARF4.pdf

Update #4829

R=minux.ma, iant
CC=dave, golang-dev
https://golang.org/cl/7354043
2013-02-20 00:58:31 +08:00
Donovan Hide
937f91e1da strings: faster Count, Index
Slightly better benchmarks for when string and separator are equivalent and also less branching in inner loops.
benchmark                        old ns/op    new ns/op    delta
BenchmarkGenericNoMatch               3430         3442   +0.35%
BenchmarkGenericMatch1               23590        22855   -3.12%
BenchmarkGenericMatch2              108031       105025   -2.78%
BenchmarkSingleMaxSkipping            2969         2704   -8.93%
BenchmarkSingleLongSuffixFail         2826         2572   -8.99%
BenchmarkSingleMatch                205268       197832   -3.62%
BenchmarkByteByteNoMatch               987          921   -6.69%
BenchmarkByteByteMatch                2014         1749  -13.16%
BenchmarkByteStringMatch              3083         3050   -1.07%
BenchmarkHTMLEscapeNew                 922          915   -0.76%
BenchmarkHTMLEscapeOld                1654         1570   -5.08%
BenchmarkByteByteReplaces            11897        11556   -2.87%
BenchmarkByteByteMap                  4485         4255   -5.13%
BenchmarkIndexRune                     174          121  -30.46%
BenchmarkIndexRuneFastPath              41           41   -0.24%
BenchmarkIndex                          45           44   -0.22%
BenchmarkMapNoChanges                  433          431   -0.46%
BenchmarkIndexHard1                4015336      3316490  -17.40%
BenchmarkIndexHard2                3976254      3395627  -14.60%
BenchmarkIndexHard3                3973158      3378329  -14.97%
BenchmarkCountHard1                4403549      3448512  -21.69%
BenchmarkCountHard2                4387437      3413059  -22.21%
BenchmarkCountHard3                4403891      3382661  -23.19%
BenchmarkIndexTorture                28354        25864   -8.78%
BenchmarkCountTorture                29625        27463   -7.30%
BenchmarkFields                   38752040     39169840   +1.08%
BenchmarkFieldsFunc               38797765     38888060   +0.23%

benchmark                         old MB/s     new MB/s  speedup
BenchmarkSingleMaxSkipping         3367.07      3697.62    1.10x
BenchmarkSingleLongSuffixFail       354.51       389.47    1.10x
BenchmarkSingleMatch                 73.07        75.82    1.04x
BenchmarkFields                      27.06        26.77    0.99x
BenchmarkFieldsFunc                  27.03        26.96    1.00x

R=dave, fullung, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/7350045
2013-02-19 10:36:15 -05:00
Russ Cox
9704c80b93 A+C: Donovan Hide (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7351046
2013-02-19 10:36:03 -05:00
Russ Cox
f19cf640d4 codereview: give up on http fetch after 30 seconds
If Python blocks in the SSL handshake it seems to be
completely uninterruptible, and I've been seeing it
block for at least hours recently. I don't know if the
problem is on the client side or the server side or
somewhere in the network, but setting the timeout
at least means you're guaranteed a new shell prompt
(after printing some errors).

R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/7337048
2013-02-19 10:18:16 -05:00
Russ Cox
cb32ea9c19 runtime: replace bubble sort with heap sort in select
R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/7304106
2013-02-19 10:15:13 -05:00
Russ Cox
a6db2a8517 reflect: document tie-breaking in Select
The exact words are taken from the spec.

Fixes some confusion on golang-nuts.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7353044
2013-02-19 10:13:53 -05:00
Robin Eklind
d137a2cb56 src: use internal tests if possible
If a test can be placed in the same package ("internal"), it is placed
there. This facilitates testing of package-private details. Because of
dependency cycles some packages cannot be tested by internal tests.

R=golang-dev, rsc, mikioh.mikioh
CC=golang-dev, r
https://golang.org/cl/7323044
2013-02-19 10:02:01 -05:00
Shenghou Ma
d251fc39f2 doc/gccgo_contribute: mention gofrontend-dev@googlegroups.com mailing list
R=iant
CC=golang-dev
https://golang.org/cl/7323064
2013-02-19 19:20:44 +08:00
Lucio De Re
7b5de7240e src/run.rc: "go env -9" is not valid, the correct command is "go tool dist env -9".
R=minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7307120
2013-02-19 19:02:18 +08:00
Volker Dobler
6ab113531b exp/cookiejar: store cookies under TLD+1 on nil public suffix list
The current implementation would store all cookies received from
any .com domain under "com" in the entries map if a nil public
suffix list is used in constructing the Jar. This is inefficient.

This CL uses the TLD+1 of the domain if the public suffix list
is nil which has two advantages:
 - It uses the entries map efficiently.
 - It prevents a host foo.com to set cookies for bar.com.
   (It may set the cookie, but it won't be returned to bar.com.)
A domain like www.british-library.uk may still set a domain
cookie for .british-library.uk in this case.

The behavior for a non-nil public suffix list is unchanged, cookies
are stored under eTLD+1 in this case.

R=nigeltao
CC=golang-dev
https://golang.org/cl/7312105
2013-02-19 19:12:36 +11:00
Andrew Wilkins
68ff170ebe go/types: Permit dereferencing of named pointer types.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/7358044
2013-02-18 19:03:10 -08:00
Robert Griesemer
95aaca6708 go/types: Pkg *Package field for all objects
The field is nil for predeclared (universe)
objects and parameter/result variables.

R=adonovan
CC=golang-dev
https://golang.org/cl/7312093
2013-02-18 14:40:47 -08:00
Russ Cox
86d509b463 runtime: preparation for non-Go threads running Go code
* Handle p==nil in signalstack by setting SS_DISABLE flag.
* Make minit only allocate a signal g if there's not one already.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7323072
2013-02-18 13:43:12 -05:00
Russ Cox
07e87885ad cmd/6c: fix build
copy+paste error while cleaning up CL 7303099 before submit

R=ken2
CC=golang-dev
https://golang.org/cl/7308104
2013-02-18 13:29:55 -05:00
Russ Cox
139448fe95 cmd/6c, cmd/8c: cut stack frames by about half
The routine that adds an automatic to the stack was
adding ptrsize-1 to the size before rounding up.
That addition would only make sense to turn a round down
into a round up. Before a round up, it just wastes a word.

The effect was that a 6c function with one local and
one two-word function call used (8+8)+(16+8) = 40 bytes
instead of 8+16 = 24 bytes.

The wasted space mostly didn't matter, but one place where
it does matter is when trying to stay within the 128-byte
total frame constraint for #pragma textflag 7 functions.

This only affects the C compilers, not the Go compilers.

5c already had correct code, which is now copied to 6c and 8c.

R=ken2
CC=golang-dev
https://golang.org/cl/7303099
2013-02-18 13:24:04 -05:00
Dmitriy Vyukov
d62239b5f6 runtime/debug: make TestFreeOSMemory repeatable
Fixes #4835.

R=golang-dev, fullung
CC=golang-dev
https://golang.org/cl/7319050
2013-02-18 15:46:36 +04:00
David Symonds
8ecc4cb41e misc/vim: update installation instructions to work better with some Linux distributions.
Fixes #3308.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7301086
2013-02-18 14:03:47 +11:00
Volker Dobler
6bbd12f176 exp/cookiejar: make cookie sorting deterministic.
Re-enable TestUpdateAndDelete, TestExpiration, TestChromiumDomain and
TestChromiumDeletion on Windows.

Sorting of cookies with same path length and same creation
time is done by an additional seqNum field.
This makes the order in which cookies are returned in Cookies
deterministic, even if the system clock is manipulated or on
systems with a low-resolution clock.

The tests now use a synthetic time: This makes cookie testing
reliable in case of bogus system clocks and speeds up the
expiration tests.

R=nigeltao, alex.brainman, dave
CC=golang-dev
https://golang.org/cl/7323063
2013-02-18 11:27:41 +11:00
Joel Sing
556dd0bfbd runtime: fix sigaction struct on freebsd
Fix the sa_mask member of the sigaction struct - on FreeBSD this is
declared as a sigset_t, which is an array of four unsigned ints.
Replace the current int64 with Sigset from defs_freebsd_GOARCH, which
has the correct definition.

Unbreaks the FreeBSD builds.

R=golang-dev, dave, minux.ma
CC=golang-dev
https://golang.org/cl/7333047
2013-02-18 03:23:29 +11:00
Rémy Oudompheng
23093f86ee strings: better mean complexity for Count and Index.
The O(n+m) complexity is obtained probabilistically
by using Rabin-Karp algorithm, which provides the needed complexity
unless exceptional collisions occur, without memory allocation.

benchmark                 old ns/op    new ns/op    delta
BenchmarkIndexHard1         6532331      4045886  -38.06%
BenchmarkIndexHard2         8178173      4038975  -50.61%
BenchmarkIndexHard3         6973687      4042591  -42.03%
BenchmarkCountHard1         6270864      4071090  -35.08%
BenchmarkCountHard2         7838039      4072853  -48.04%
BenchmarkCountHard3         6697828      4071964  -39.20%
BenchmarkIndexTorture       2730546        28934  -98.94%
BenchmarkCountTorture       2729622        29064  -98.94%

Fixes #4600.

R=rsc, donovanhide, remyoudompheng
CC=golang-dev
https://golang.org/cl/7314095
2013-02-17 13:07:17 +01:00
Georg Reinke
f1037f0e86 runtime: fix build on openbsd
R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/7312104
2013-02-17 02:06:59 +11:00
Mikio Hara
c02d18ab34 net: add IPConn through Conn test
Also refactors mock ICMP stuff.

R=dave, rsc
CC=golang-dev
https://golang.org/cl/7325043
2013-02-16 12:55:39 +09:00
Dave Cheney
21327e1970 runtime: fix unused variable warning
R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/7312103
2013-02-16 14:32:04 +11:00
Russ Cox
60526ca6d1 undo CL 7310096 / 59da6744d66d
broke windows build

««« original CL description
runtime: ensure forward progress of runtime.Gosched() for locked goroutines
The removed code leads to the situation when M executes the same locked G again and again.
Fixes #4820.

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

TBR=dvyukov
CC=golang-dev
https://golang.org/cl/7343050
2013-02-15 17:54:46 -05:00
Russ Cox
c92d3552e5 os: point users of ProcessState.SysUsage to getrusage(2)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7352044
2013-02-15 17:11:13 -05:00
Russ Cox
6d888f1e1b build: clang support
This works with at least one version of clang
that existed at one moment in time.
No guarantees about clangs past or future.

To try:
        CC=clang all.bash

It does not work with the Xcode clang,
because that clang fails at printing a useful answer
to:
        clang -print-libgcc-file-name
The clang that works prints a full path name for
that command, not just "libgcc.a".

Fixes #4713.

R=iant, minux.ma
CC=golang-dev
https://golang.org/cl/7323068
2013-02-15 13:37:43 -08:00
Russ Cox
428c4cc8d4 api: refresh next.txt
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7317049
2013-02-15 16:33:14 -05:00
Russ Cox
0c3b17a55a runtime: allow mem profiles with GOGC=off
Fixes #3586.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7304098
2013-02-15 14:48:58 -05:00
Russ Cox
6c1539bb01 runtime: show frame pointer values during throw
Should help if stack overflows start happening again.

Fixes #3582.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7311098
2013-02-15 14:48:47 -05:00
Russ Cox
c8214c78bd runtime: make return from main wait for active panic
Arguably if this happens the program is buggy anyway,
but letting the panic continue looks better than interrupting it.
Otherwise things like this are possible, and confusing:

$ go run x.go
panic: $ echo $?
0
$

Fixes #3934.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7322083
2013-02-15 14:48:35 -05:00
Russ Cox
2d4164596f cmd/go: reject case-insensitive file name, import collisions
To make sure that Go code will work when moved to a
system with a case-insensitive file system, like OS X or Windows,
reject any package built from files with names differing
only in case, and also any package built from imported
dependencies with names differing only in case.

Fixes #4773.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7314104
2013-02-15 14:39:39 -05:00
Russ Cox
61e02ee901 spec: clarify when range x does not evaluate x
Fixes #4644.

R=r, adonovan
CC=golang-dev
https://golang.org/cl/7307083
2013-02-15 14:39:28 -05:00
Russ Cox
318309a51f runtime/pprof: adjust reported line numbers to show call sites
This is the same logic used in the standard tracebacks.
The caller pc is the pc after the call, so except in the
fake "call" caused by a panic, back up the pc enough
that the lookup will use the previous instruction.

Fixes #4150.
Fixes #4151.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7317047
2013-02-15 14:27:16 -05:00
Russ Cox
8a6ff3ab34 runtime: allocate heap metadata at run time
Before, the mheap structure was in the bss,
but it's quite large (today, 256 MB, much of
which is never actually paged in), and it makes
Go binaries run afoul of exec-time bss size
limits on some BSD systems.

Fixes #4447.

R=golang-dev, dave, minux.ma, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/7307122
2013-02-15 14:27:03 -05:00
Dmitriy Vyukov
f87b7f67b2 runtime: ensure forward progress of runtime.Gosched() for locked goroutines
The removed code leads to the situation when M executes the same locked G again and again.
Fixes #4820.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7310096
2013-02-15 22:22:13 +04:00
Russ Cox
d3d89ae7d2 runtime: check rt_sigaction return values on linux
(If the mask size is wrong the system call fails.)

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7305097
2013-02-15 13:13:19 -05:00
Russ Cox
2b9787c2f3 encoding/binary: make type error more specific
Right now it says 'invalid type S' for a struct type S.
Instead, say which type inside the struct is the problem.

Fixes #4825.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7301102
2013-02-15 13:12:28 -05:00
Russ Cox
d47cc872b5 exp/cookiejar: fix windows/386 build
More mysteriously broken tests.

TBR=nigeltao
CC=golang-dev
https://golang.org/cl/7342048
2013-02-15 12:43:28 -05:00
Russ Cox
c7f7bbbf03 runtime: fix build on linux
In addition to the compile failure fixed in signal*.c,
preserving the signal mask led to very strange crashes.
Testing shows that looking for SIG_IGN is all that
matters to get along with nohup, so reintroduce
sigset_zero instead of trying to preserve the signal mask.

TBR=iant
CC=golang-dev
https://golang.org/cl/7323067
2013-02-15 12:18:33 -05:00
Russ Cox
f8f2727ab5 exp/cookiejar: fix windows builder
TBR=nigeltao
CC=golang-dev
https://golang.org/cl/7322084
2013-02-15 11:32:31 -05:00
Russ Cox
f3407f445d runtime: fix running under nohup
There are two ways nohup(1) might be implemented:
it might mask away the signal, or it might set the handler
to SIG_IGN, both of which are inherited across fork+exec.
So two fixes:

* Make sure to preserve the inherited signal mask at
minit instead of clearing it.

* If the SIGHUP handler is SIG_IGN, leave it that way.

Fixes #4491.

R=golang-dev, mikioh.mikioh, iant
CC=golang-dev
https://golang.org/cl/7308102
2013-02-15 11:18:55 -05:00
Adam Langley
5b20a18f3b crypto/x509: support IP SANs.
Subject Alternative Names in X.509 certificates may include IP
addresses. This change adds support for marshaling, unmarshaling and
verifying this form of SAN.

It also causes IP addresses to only be checked against IP SANs,
rather than against hostnames as was previously the case. This
reflects RFC 6125.

Fixes #4658.

R=golang-dev, mikioh.mikioh, bradfitz
CC=golang-dev
https://golang.org/cl/7336046
2013-02-15 10:40:17 -05:00
Dmitriy Vyukov
a9824f178d runtime: fix debug output
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7312101
2013-02-15 17:04:02 +04:00
Alex Brainman
d844001601 mime: do not test for .wav on windows
Even builders don't have that mime type

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/7314106
2013-02-15 16:55:51 +11:00
Alex Brainman
f9dbbdb1d3 mime: use .wav instead of .bmp during windows tests
Some systems do not have .bmp mime.

Update #4723.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7326047
2013-02-15 15:52:54 +11:00
Alex Brainman
d71b3921f7 net: delete TestDialTimeoutHandleLeak
It is too flaky. Tried to make it more reliable,
but that affects other tests (they run too long),
because we do unusual things here, like attempting
to connect to non-existing address and interrupt.

R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7314097
2013-02-15 15:52:12 +11:00