1
0
mirror of https://github.com/golang/go synced 2024-09-30 22:08:32 -06:00
Commit Graph

1560 Commits

Author SHA1 Message Date
Russ Cox
d314e3a68e doc/codewalk: gofmt pig.go
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7221079
2013-01-31 13:42:26 -08:00
Russ Cox
779e9dfd4d doc/go1.1.html: document division by zero change from CL 6710045
I am still not convinced this is a change we should make, but at least
documenting it will keep us from forgetting it as we get closer to Go 1.1.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7226064
2013-01-30 09:23:36 -08:00
Andrew Gerrand
7a389b61d4 doc: add mention of the Go+ community
R=golang-dev, iant, kamil.kisiel, minux.ma
CC=golang-dev
https://golang.org/cl/7203049
2013-01-25 08:27:34 +11:00
Oling Cat
018e89fa69 doc/go_spec: remove extra space, align tags, and change a tab to a space.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7198048
2013-01-24 20:46:33 +11:00
Oling Cat
f1c397f0ea doc/articles/race_detector: fix some format.
R=golang-dev, bradfitz, minux.ma, adg
CC=golang-dev
https://golang.org/cl/7137049
2013-01-23 14:22:03 +11:00
Russ Cox
f8284b64ce doc/effective_go.html: add a section about the blank identifier
R=golang-dev, minux.ma, bradfitz, adg
CC=golang-dev
https://golang.org/cl/7134056
2013-01-22 14:00:10 -05:00
Shenghou Ma
a0b5b46ae4 doc/go_spec: cap doesn't apply to maps
Fixes #4682.

R=golang-dev, adg, dave
CC=golang-dev
https://golang.org/cl/7094062
2013-01-22 03:18:20 +08:00
Nigel Tao
c8c8ab08ed doc: fix effective_go: s/byte array/byte slice/.
R=rsc
CC=golang-dev, mdempsky
https://golang.org/cl/7062049
2013-01-19 13:36:59 +11:00
Robert Griesemer
d3679726b4 spec: clarify lhs syntax for range and select
Fixes #4653.

R=rsc, r, iant, ken, thakis
CC=golang-dev
https://golang.org/cl/7135058
2013-01-18 13:59:25 -08:00
Russ Cox
c64469f8e8 doc/contribute.html: mention hg mail during hg change discussion
People keep not reading all the way to the bottom of the doc
and not running hg mail.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7137057
2013-01-18 14:08:42 -05:00
Andrew Gerrand
c022943449 html/template: remove noescape support
This was never documented or properly implemented.

Fixes #3528.

R=mikesamuel, rsc
CC=golang-dev
https://golang.org/cl/7142048
2013-01-18 10:30:12 +11:00
Shenghou Ma
ced57153df doc/go_spec.html: clarification about insertion during map iteration
R=mdempsky, iant, r, gri, rsc, ken
CC=golang-dev
https://golang.org/cl/7100046
2013-01-17 23:11:25 +08:00
Oling Cat
f5958c6141 doc/articles/json_and_go: fix some format.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7131045
2013-01-17 15:08:20 +11:00
Andrew Gerrand
399a36a634 doc: fix various fragment links
R=dsymonds
CC=golang-dev
https://golang.org/cl/7094058
2013-01-15 19:25:16 +11:00
Matthew Dempsky
7d403871cb doc/contribute: Link to IssueTracker docs for more "special sentences"
Update #4582.

R=nigeltao, dave, adg
CC=golang-dev
https://golang.org/cl/7070065
2013-01-10 14:17:20 +11:00
Dave Cheney
593d8b0c14 cmd/go: remove $GOROOT as a go get target
Fixes #4186.

Back in the day, before the Go 1.0 release, $GOROOT was mandatory for building from source. Fast forward to now and $GOPATH is mandatory and $GOROOT is optional, and mainly used by those who use the binary distribution in uncommon places.

For example, most novices at least know about `sudo` as they would have used it to install the binary tarball into /usr/local. It is logical they would use the `sudo` hammer to `go get` other Go packages when faced with a permission error talking about the path they just had to use `sudo` on last time.

Even if they had read the documentation and set $GOPATH, go get will not work as expected as `sudo` masks most environment variables.

llucky(~) % ~/go/bin/go env | grep GOPATH
GOPATH="/home/dfc"
lucky(~) % sudo ~/go/bin/go env | grep GOPATH
GOPATH=""

This CL therefore proposes to remove support for using `go get` to download source into $GOROOT.

This CL also proposes an error when GOPATH=$GOROOT, as this is another place where new Go users can get stuck.

Further discussion: https://groups.google.com/d/topic/golang-nuts/VIg3fjHiHRI/discussion

R=rsc, adg, minux.ma
CC=golang-dev
https://golang.org/cl/6941058
2013-01-10 09:57:01 +11:00
Robert Griesemer
f1cc0f44e3 spec: clarify short variable declaration corner cases
Fixes #4612.

R=rsc, iant, ken, r
CC=golang-dev
https://golang.org/cl/7076043
2013-01-09 11:31:32 -08:00
Matthew Dempsky
a6e4aa3ef2 doc: Mention godoc's handling of example functions.
Fixes #4625.

R=iant, adg
CC=golang-dev
https://golang.org/cl/7064052
2013-01-09 07:31:25 -08:00
Oling Cat
bc776f6c58 doc/articles/go_command: remove an extra word.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7061051
2013-01-08 09:49:38 -08:00
Robert Griesemer
c863db4e87 spec: s/char_lit/rune_lit/
The spec talks explicitly about rune literals but the
respective production is still called char_lit for
historic reasons. Updated the two occurences.

Fixes #4602.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/7070048
2013-01-07 18:02:58 -08:00
Caleb Spare
41f32e0dff doc: two minor edits to contribute.html
- Missing parenthesis
- Fix bad phrasing

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7063048
2013-01-06 22:44:16 -05:00
Matthew Dempsky
80a87a99cc spec: Use "non-negative" instead of "positive"
Replacing division-by-power-of-2 with right-shift is valid for
zero too.

R=gri
CC=golang-dev
https://golang.org/cl/7027049
2013-01-06 16:56:06 -08:00
Robin Eklind
1e1aea6821 doc: Updated links for sub-repository documentation.
Use godoc.org instead of gopkgdoc.appspot.com.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7036051
2013-01-07 09:10:09 +11:00
Russ Cox
cbbc6a102d cmd/5l, cmd/6l, cmd/8l, cmd/cc, cmd/gc: new flag parsing
This CL adds a flag parser that matches the semantics of Go's
package flag. It also changes the linkers and compilers to use
the new flag parser.

Command lines that used to work, like
        8c -FVw
        6c -Dfoo
        5g -I/foo/bar
now need to be split into separate arguments:
        8c -F -V -w
        6c -D foo
        5g -I /foo/bar
The new spacing will work with both old and new tools.

The new parser also allows = for arguments, as in
        6c -D=foo
        5g -I=/foo/bar
but that syntax will not work with the old tools.

In addition to matching standard Go binary flag parsing,
the new flag parser generates more detailed usage messages
and opens the door to long flag names.

The recently added gc flag -= has been renamed -complete.

R=remyoudompheng, daniel.morsing, minux.ma, iant
CC=golang-dev
https://golang.org/cl/7035043
2013-01-06 15:24:47 -05:00
Russ Cox
4e2aa9bff0 cmd/ld: use native-endian symbol values in symbol table
The Plan 9 symbol table format defines big-endian symbol values
for portability, but we want to be able to generate an ELF object file
and let the host linker link it, as part of the solution to issue 4069.
The symbol table itself, since it is loaded into memory at run time,
must be filled in by the final host linker, using relocation directives
to set the symbol values. On a little-endian machine, the linker will
only fill in little-endian values during relocation, so we are forced
to use little-endian symbol values.

To preserve most of the original portability of the symbol table
format, we make the table itself say whether it uses big- or
little-endian values. If the table begins with the magic sequence
        fe ff ff ff 00 00
then the actual table begins after those six bytes and contains
little-endian symbol values. Otherwise, the table is in the original
format and contains big-endian symbol values. The magic sequence
looks like an "end of table" entry (the fifth byte is zero), so legacy
readers will see a little-endian table as an empty table.

All the gc architectures are little-endian today, so the practical
effect of this CL is to make all the generated tables little-endian,
but if a big-endian system comes along, ld will not generate
the magic sequence, and the various readers will fall back to the
original big-endian interpretation.

R=ken2
CC=golang-dev
https://golang.org/cl/7066043
2013-01-04 17:03:57 -05:00
Robert Griesemer
614b02d22a spec: clarify language about unary operator &
A composite literal may be parenthesized when
used as operand for the unary operator &.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6996053
2013-01-02 18:11:49 -08:00
Dmitriy Vyukov
b2e9ca7f2e doc: add race detector manual
R=minux.ma, franciscossouza, rsc, adg, adg
CC=golang-dev
https://golang.org/cl/6948043
2013-01-02 16:38:47 +04:00
Andrew Gerrand
d5d046e306 doc: update standard copyright header
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7034044
2013-01-02 16:26:25 +11:00
Péter Surányi
be7c0f31c7 doc: fix id attributes in links to godoc
CL6449105 changed godoc id attributes to ensure uniqueness.
This CL updates links to godoc pages in documents that used
the old id attributes.

R=golang-dev, dsymonds
CC=golang-dev, speter.go1
https://golang.org/cl/7015051
2012-12-29 10:41:39 +11:00
Shenghou Ma
fcc5cf639e doc/articles/wiki/test.bash: suppress unnecessary output
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7000045
2012-12-24 03:48:17 +08:00
Russ Cox
04098d88fa cmd/gc: make forward declaration in pure Go package an error
An error during the compilation can be more precise
than an error at link time.

For 'func init', the error happens always: you can't forward
declare an init func because the name gets mangled.

For other funcs, the error happens only with the special
(and never used by hand) -= flag, which tells 6g the
package is pure go.

The go command now passes -= for pure Go packages.

Fixes #3705.

R=ken2
CC=golang-dev
https://golang.org/cl/6996054
2012-12-22 16:46:46 -05:00
Joel Sing
708db79011 cgo: enable cgo on openbsd
Enable cgo on OpenBSD.

The OpenBSD ld.so(1) does not currently support PT_TLS sections. Work
around this by fixing up the TCB that has been provided by librthread
and reallocating a TCB with additional space for TLS. Also provide a
wrapper for pthread_create, allowing zeroed TLS to be allocated for
threads created externally to Go.

Joint work with Shenghou Ma (minux).

Requires change 6846064.

Fixes #3205.

R=golang-dev, minux.ma, iant, rsc, iant
CC=golang-dev
https://golang.org/cl/6853059
2012-12-21 01:43:19 +11:00
Shenghou Ma
7777bac6e4 runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.

Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow          110          118   +7.27%

Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow          625          542  -13.28%

Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow          992          909   -8.37%

FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow          699          695   -0.57%

FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow         1553         1658   +6.76%

OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow         1262         1236   -2.06%

OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow         5089         5043   -0.90%

NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow          277          278   +0.36%

NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark       old ns/op    new ns/op    delta
BenchmarkNow          103          105   +1.94%

Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.

R=jsing, dave, rsc
CC=golang-dev
https://golang.org/cl/6820120
2012-12-18 22:57:25 +08:00
Mikio Hara
0d197251ee net: change ListenUnixgram signature to return UnixConn instead of UDPConn
This CL breaks Go 1 API compatibility but it doesn't matter because
previous ListenUnixgram doesn't work in any use cases, oops.

The public API change is:
-pkg net, func ListenUnixgram(string, *UnixAddr) (*UDPConn, error)
+pkg net, func ListenUnixgram(string, *UnixAddr) (*UnixConn, error)

Fixes #3875.

R=rsc, golang-dev, dave
CC=golang-dev
https://golang.org/cl/6937059
2012-12-16 11:51:47 +09:00
Andrew Gerrand
641d152935 go/doc: hide "Program exited." message from front page playground output
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6934049
2012-12-13 15:35:38 +11:00
Andrew Gerrand
c8ce844d5a doc/play: sync playground.js with go-playground repo
Also add style for "Program exited." message.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6934047
2012-12-13 14:32:03 +11:00
Robert Griesemer
462860bd8d spec: more explicit comments for constant expression examples
Fixes #3814.

R=rsc, iant
CC=golang-dev
https://golang.org/cl/6920057
2012-12-12 14:25:40 -08:00
Robert Griesemer
a9a49fe962 spec: calling delete on a nil map is a no-op
This is language change. It is a backward-compatible
change but for code that relies on a run-time panic
when calling delete on a nil map (unlikely).

Fixes #4253.

R=rsc, r, iant, ken, bradfitz, rogpeppe
CC=golang-dev
https://golang.org/cl/6909060
2012-12-12 13:08:35 -08:00
Robert Griesemer
3906706297 spec: index and array/slice size constants must fit into an int
R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6903048
2012-12-12 11:06:26 -08:00
Rob Pike
17b3766d18 doc/gopher: add high-resolution pencil sketches
These are higher-resolution scans of the little
drawings used as clip art on golang.org

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6929058
2012-12-12 10:51:13 -08:00
Russ Cox
111fcf1579 doc/contribute: mention 'hg help codereview'
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6932053
2012-12-11 13:36:43 -05:00
Robin Eklind
1d46fc44b7 spec: Correct typo in method expressions example.
Also, remove unnecessary whitespace.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6928045
2012-12-11 12:17:53 -05:00
Russ Cox
014137c839 doc/go1.1.html: add warning about net.ResolveTCPAddr error checking
Suggested by Paul Borman.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6930043
2012-12-10 18:08:07 -05:00
Robert Griesemer
9c9e811bb3 spec: consistently use "indices" (rather than "indexes")
We have been using all three terms "indices", "indexes",
and "index expressions" indiscriminatly for index values.
With this change, "index" refers to an index value,
"indices" is the plural of "index", and "index expression"
refers to an array, slice, or map indexed by an index: a[x].

R=r, rsc, iant, ken, mtj
CC=golang-dev
https://golang.org/cl/6912056
2012-12-10 11:55:57 -08:00
Russ Cox
00cd6a3be3 time: add Round and Truncate
New in Go 1 will be nanosecond precision in the result of time.Now on Linux.
This will break code that stores time in external formats at microsecond
precision, reads it back, and expects to get exactly the same time.

Code like that can be fixed by using time.Now().Round(time.Microsecond)
instead of time.Now() in those contexts.

R=golang-dev, bradfitz, iant, remyoudompheng
CC=golang-dev
https://golang.org/cl/6903050
2012-12-09 03:59:33 -05:00
Robert Griesemer
e06d90136f spec: receiver types in method expressions can be parenthesized
Fixes #4457.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6862046
2012-12-06 09:31:42 -08:00
Robert Griesemer
485673188d spec: type assertions and type switches must be valid
The spec didn't preclude invalid type assertions and
type switches, i.e., cases where a concrete type doesn't
implement the interface type in the assertion in the first
place. Both, the gc and gccgo compiler exclude these cases.
This is documenting the status quo.

Also:
- minor clean up of respective examples
- added sentence about default case in select statements

Fixes #4472.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6869050
2012-12-06 09:17:20 -08:00
Robert Griesemer
458632a21a spec: BuiltinCall syntax must permit "..." for append
Also: fix an incorrect link.

Fixes #4479.
Fixes #4456.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6868062
2012-12-04 13:09:02 -08:00
Mikio Hara
23ca24018a doc: clear execute bit
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6871057
2012-12-04 20:37:19 +09:00
Oling Cat
c2f9be10d4 doc/articles/godoc_documenting_go_code: fix some format issues.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6874056
2012-12-04 17:40:38 +11:00