1
0
mirror of https://github.com/golang/go synced 2024-11-12 02:50:25 -07:00
Commit Graph

1728 Commits

Author SHA1 Message Date
Rob Pike
bd65404eef spec: clarify a couple of issues about channels
1. They are FIFOs.
2. They are safe for concurrent access.

Fixes #5911.

R=golang-dev, dvyukov, adg
CC=golang-dev
https://golang.org/cl/11549043
2013-08-01 07:12:32 +10:00
Robert Griesemer
9f75dd7f25 undo CL 11884043 / bfd5ed8236d5
CL submitted prematurely by mistake.

««« original CL description
spec: clarify index and selector expressions

1) Explain a[i] and a[i:j] where a is of type *A as
   shortcut for (*a)[i] and (*a)[i:j], respectively.

2) Together with 1), because len() of nil slices is
   well defined, there's no need to special case nil
   operands anymore.

3) The result of indexing or slicing a constant string
   is always a non-constant byte or string value.

4) The result of slicing an untyped string is a value
   of type string.

5) If the operand of a valid slice a[i:j] is nil (i, j
   must be 0 for it to be valid - this already follows
   from the in-range rules), the result is a nil slice.

Fixes #4913.
Fixes #5951.

R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/11884043
»»»

R=r
CC=golang-dev
https://golang.org/cl/12170046
2013-07-31 14:10:46 -07:00
Robert Griesemer
58d2960655 spec: clarify index and selector expressions
1) Explain a[i] and a[i:j] where a is of type *A as
   shortcut for (*a)[i] and (*a)[i:j], respectively.

2) Together with 1), because len() of nil slices is
   well defined, there's no need to special case nil
   operands anymore.

3) The result of indexing or slicing a constant string
   is always a non-constant byte or string value.

4) The result of slicing an untyped string is a value
   of type string.

5) If the operand of a valid slice a[i:j] is nil (i, j
   must be 0 for it to be valid - this already follows
   from the in-range rules), the result is a nil slice.

Fixes #4913.
Fixes #5951.

R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/11884043
2013-07-31 13:40:01 -07:00
Andrew Gerrand
d920d8d849 doc: don't block page load on JavaScript fetch
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12050045
2013-07-30 14:22:14 +10:00
Andrew Gerrand
fc32bfa9cc doc/codewalk: test source code
Fixes #2648.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11331043
2013-07-30 09:42:53 +10:00
Andrew Gerrand
f6dd45bf82 doc/articles: state that slices/arrays start at the 0th element
Fixes #5881.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11892043
2013-07-29 18:33:39 +10:00
Rémy Oudompheng
d26d5e6403 effective_go.html: make snippets look formatted.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11991043
2013-07-29 00:57:19 +02:00
Robert Griesemer
f331012427 spec: update prose in Constants section
Fixes #5952.

R=r, rsc
CC=golang-dev
https://golang.org/cl/11812043
2013-07-25 09:35:55 -07:00
Andrew Bonventre
f652bc4acf doc/go1.2.txt: document new functions/types added to image/gif and image/draw.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11492045
2013-07-24 12:41:52 +10:00
Rob Pike
ac94c06d1e doc/go1.2.txt: document new function unicode.In
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/11745044
2013-07-24 10:54:33 +10:00
Rob Pike
abe384f68a all: be more idiomatic when documenting boolean return values.
Phrases like "returns whether or not the image is opaque" could be
describing what the function does (it always returns, regardless of
the opacity) or what it returns (a boolean indicating the opacity).
Even when the "or not" is missing, the phrasing is bizarre.

Go with "reports whether", which is still clunky but at least makes
it clear we're talking about the return value.

These were edited by hand. A few were cleaned up in other ways.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/11699043
2013-07-23 11:59:49 +10:00
Andrew Gerrand
01cc462bfc doc: fix wiki content error
Fixes #5898.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11556043
2013-07-22 12:22:14 +10:00
Dave Cheney
deee03f17e doc/effective_go: stamp out stray GOROOT reference
Replaced with something more appropriate.

R=adg, r, minux.ma
CC=golang-dev
https://golang.org/cl/11421043
2013-07-17 18:48:55 +10:00
Russ Cox
64054a40ad encoding/json: coerce invalid UTF-8 to valid UTF-8 during Marshal
In practice, rejecting an entire structure due to a single invalid byte
in a string is just too picky, and too hard to track down.
Be consistent with the bulk of the standard library by converting
invalid UTF-8 into UTF-8 with replacement runes.

R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/11211045
2013-07-12 17:37:10 -04:00
Robert Griesemer
63f54ae3c2 spec: move decl in example closer to use
Fixes #5862.

R=r
CC=golang-dev
https://golang.org/cl/11168043
2013-07-11 14:41:46 -07:00
Shenghou Ma
72faa4bc51 syscall: implement Sendfile for Darwin.
Update #5847
Summary: syscall: implement Sendfile for OpenBSD and NetBSD

R=golang-dev, rsc, dave
CC=golang-dev
https://golang.org/cl/10980043
2013-07-12 04:34:54 +08:00
Robert Griesemer
8268eadb9e spec: define notion of named type
The notion of a named type is crucial for the definition
of type identity, assignability, definitions of methods.
Explicitly introduce the notion with an extra sentence.

Fixes #5682.

R=r, rsc, iant
CC=golang-dev
https://golang.org/cl/11055043
2013-07-09 21:12:53 -07:00
Andrew Gerrand
1856286fc2 doc: update playground.js
R=dsymonds
CC=golang-dev
https://golang.org/cl/10933044
2013-07-04 14:24:21 +10:00
Rob Pike
f3aa009a12 doc/go1.2.txt: stable sort
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/10761048
2013-07-03 11:46:09 +10:00
Andrew Gerrand
493538adbf cmd/godoc: set up playground for examples that are already visible
This fixes an issue where linking directly to an example makes it not
runnable and visible only in a tiny window. To see the bug in action,
visit this link: http://golang.org/pkg/strings/#example_Map

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10679050
2013-07-02 08:44:25 +10:00
Rick Arnold
49b3301f4c flag: add Getter interface; implement for all Value types
Fixes #5383.

R=golang-dev, 0xjnml, r, rsc
CC=golang-dev
https://golang.org/cl/10472043
2013-06-27 15:30:45 -07:00
Rob Pike
4f2278d4db doc/go1.2.txt: cmd/go and coverage; simple hash Sum functions
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/10631043
2013-06-27 09:20:02 -07:00
Robert Griesemer
de47f68c99 spec: fix spec on conversions to match implementations
The existing compilers convert empty strings to empty
but non-nil byte and rune slices. The spec required
a nil byte and rune slice in those cases. That seems
an odd additional requirement. Adjust the spec to
match the reality.

Also, removed over-specification for conversions of
nil []byte and []rune: such nil slices already act
like empty slices and thus don't need extra language.
Added extra examples instead.

Fixes #5704.

R=rsc, r, iant
CC=golang-dev
https://golang.org/cl/10440045
2013-06-21 16:11:13 -07:00
Ian Lance Taylor
ffde4970d0 doc: update gccgo docs
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10401046
2013-06-20 14:49:15 -07:00
Andrew Gerrand
7468b1d36a doc: style tweaks in preparation for Google Feedback link
Fixes #5589.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/10272051
2013-06-18 15:26:15 +10:00
Andrew Gerrand
55511d2b34 doc: add go1.1.1 to the release notes
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/10236045
2013-06-13 12:43:26 +10:00
Shenghou Ma
06f55f5009 net: introduce netgo build tag to build a pure Go net package.
Fixes #4078.

R=golang-dev, bradfitz, rsc, iant
CC=golang-dev
https://golang.org/cl/7100050
2013-06-11 02:55:16 +08:00
Shenghou Ma
bdac989ef7 doc/go_spec: more examples for unspecified cases of the evaluation order
R=golang-dev, bradfitz, gri, iant, rsc
CC=golang-dev
https://golang.org/cl/7235044
2013-06-11 02:52:07 +08:00
Shenghou Ma
177191237e doc/install-source.html: recent ARM and 386 updates
R=golang-dev, dave, adg, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/6845083
2013-06-09 23:15:39 +08:00
Patrick Higgins
6bf6cae28e doc/contribute: add "Understanding the extension" section
Fixes #4996

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/7547043
2013-06-05 21:09:43 -07:00
Adam Langley
2112fed743 crypto/tls: support TLS 1.1.
The significant change between TLS 1.0 and 1.1 is the addition of an explicit IV in the case of CBC encrypted records. Support for TLS 1.1 is needed in order to support TLS 1.2.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7880043
2013-06-04 20:02:22 -04:00
Andrew Gerrand
850d1026ad doc: add Game of Life to playground toys
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/9961043
2013-06-04 12:59:28 +10:00
Shenghou Ma
022818c142 doc/articles: use C90 standard functions in the cgo article.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9953043
2013-06-04 01:40:53 +08:00
Andrew Gerrand
ae43ea432d doc: add Go 1.1 to release.html
Fixes #5468.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9853051
2013-06-03 11:52:36 +10:00
Dave Cheney
ec1769ba7b doc: update linux tarball version for Go 1.1
R=adg
CC=golang-dev
https://golang.org/cl/9819044
2013-06-03 11:47:42 +10:00
Shenghou Ma
1a145cd52d doc/go1.2.txt: update for CL 8248043.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9949044
2013-06-03 03:09:47 +08:00
Oling Cat
5b7d422a05 doc/go1.1.html: remove extra space; close some tags.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9941043
2013-06-01 10:28:04 -04:00
Robert Griesemer
ab5c762a46 spec: better wording re: receiving from closed channels
As suggested by ej@evanjones.ca.

Fixes #5604.

R=r
CC=golang-dev
https://golang.org/cl/9899043
2013-05-31 11:21:37 -07:00
Rob Pike
85fc2f70ac doc/go1.2.txt: AllocsPerRun now quantized
R=golang-dev, khr, rsc
CC=golang-dev
https://golang.org/cl/9728045
2013-05-30 12:41:20 -04:00
Shenghou Ma
5d081792b6 cmd/5a, cmd/dist, runtime: support m/g in the assembler, drop support for R9/R10
to avoid unintentionally clobber R9/R10.
Thanks Lucio for the suggestion.

PS: yes, this could be considered a big change (but not an API change), but
as it turns out even temporarily changes R9/R10 in user code is unsafe and
leads to very hard to diagnose problems later, better to disable using R9/R10
when the user first uses it.
See CL 6300043 and CL 6305100 for two problems caused by misusing R9/R10.

R=golang-dev, khr, rsc
CC=golang-dev
https://golang.org/cl/9840043
2013-05-30 03:03:52 +08:00
Katrina Owen
605da0e2a2 doc: Fix typo in approximation of square root
See https://en.wikipedia.org/wiki/Newton%27s_method#Square_root_of_a_number

R=golang-dev, minux.ma, adg
CC=golang-dev
https://golang.org/cl/9145044
2013-05-29 13:49:51 +10:00
Brian G. Merrell
20c524c5e2 effective_go.html: Fix two links
This fixes two intra-page "type assertion" links that were broken in
different ways.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/9797043
2013-05-27 11:00:12 +10:00
Rob Pike
7472ce0e58 fmt.Printf: introduce notation for random access to arguments.
This text is added to doc.go:

        Explicit argument indexes:

        In Printf, Sprintf, and Fprintf, the default behavior is for each
        formatting verb to format successive arguments passed in the call.
        However, the notation [n] immediately before the verb indicates that the
        nth one-indexed argument is to be formatted instead. The same notation
        before a '*' for a width or precision selects the argument index holding
        the value. After processing a bracketed expression [n], arguments n+1,
        n+2, etc. will be processed unless otherwise directed.

        For example,
                fmt.Sprintf("%[2]d %[1]d\n", 11, 22)
        will yield "22, 11", while
                fmt.Sprintf("%[3]*[2].*[1]f", 12.0, 2, 6),
        equivalent to
                fmt.Sprintf("%6.2f", 12.0),
        will yield " 12.00". Because an explicit index affects subsequent verbs,
        this notation can be used to print the same values multiple times
        by resetting the index for the first argument to be repeated:
                fmt.Sprintf("%d %d %#[1]x %#x", 16, 17)
        will yield "16 17 0x10 0x11".

The notation chosen differs from that in C, but I believe it's easier to read
and to remember (we're indexing the arguments), and compatibility with
C's printf was never a strong goal anyway.

While we're here, change the word "field" to "arg" or "argument" in the
code; it was being misused and was confusing.

R=rsc, bradfitz, rogpeppe, minux.ma, peter.armitage
CC=golang-dev
https://golang.org/cl/9680043
2013-05-24 15:49:26 -07:00
Russ Cox
30fde1b279 doc: start go 1.2 notes
This is a file of hints, not a file of polished text.
Let's not try to do polished text until we start the
release process.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/9750043
2013-05-24 16:34:50 -04:00
Ian Lance Taylor
452f3bc759 doc: GCC 4.8.1 is not updated to Go 1.1
I will try again for 4.8.2.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/9663045
2013-05-22 13:05:31 -07:00
David Symonds
c912150761 doc/go_faq: fix example.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/9564044
2013-05-22 12:28:58 +10:00
Robert Griesemer
6a3859f433 spec: removed old or invalid TODOs
Several old TODOs are either resolved now (e.g. when is a return
needed), or are from a time the language wasn't frozen (^ for uints
only). Consolidated the others.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9599044
2013-05-20 14:01:07 -07:00
Robert Griesemer
bb3a32ef6e spec: fix language about "range" clause
Fixes #5434.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/9595044
2013-05-20 13:27:53 -07:00
Shenghou Ma
df29cdd33d doc/go_spec: fix typos
Fixes #5456.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9400044
2013-05-15 03:50:27 +08:00
Nigel Tao
0ae5036b26 doc: add a "New packages" section to the 1.1 release notes.
R=adg, r
CC=golang-dev
https://golang.org/cl/9344044
2013-05-12 21:58:27 -07:00