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

160 Commits

Author SHA1 Message Date
Russ Cox
132e816734 doc: allow buffered channel as semaphore without initialization
This rule not existing has been the source of many discussions
on golang-dev and on issues. We have stated publicly that it is
true, but we have never written it down. Write it down.

Fixes #6242.

LGTM=r, dan.kortschak, iant, dvyukov
R=golang-codereviews, r, dominik.honnef, dvyukov, dan.kortschak, iant, 0xjnml
CC=golang-codereviews
https://golang.org/cl/75130045
2014-03-24 19:11:21 -04:00
Rob Pike
0c8415699e doc/effective_go.html: fix typo
Prose referred to 'b', code used 'buf'.
Fixes #7601.

LGTM=dominik.honnef
R=golang-codereviews, dominik.honnef
CC=golang-codereviews
https://golang.org/cl/78470043
2014-03-21 08:37:27 +11:00
Rob Pike
592415d682 effective_go: move 'Type switch' section into 'Control structures' section.
Needs to be an h3, not an h2.
Thanks to Mingjie Xing for pointing it out.

LGTM=dsymonds
R=golang-codereviews, dsymonds
CC=golang-codereviews
https://golang.org/cl/55980046
2014-01-23 16:26:42 -08:00
David Symonds
1e67453d93 doc: replace "private" with "unexported" in Effective Go.
R=r
CC=golang-codereviews
https://golang.org/cl/53720043
2014-01-17 09:06:39 -08:00
Josh Bleecher Snyder
de4ca13eac doc: fix typo in Effective Go
R=adg, bradfitz
CC=golang-codereviews
https://golang.org/cl/44430043
2013-12-20 09:59:51 -08:00
Oling Cat
b349477eab doc/effective_go.html: close some tags.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/37700043
2013-12-11 09:49:28 +11:00
Shenghou Ma
244014e402 doc/effective_go.html: fix code example
Fixes #6595.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/14425062
2013-10-15 21:30:49 -04:00
Rob Pike
7f168f9ccf doc/effective_go.html: fix unescaped less-than character
Why doesn't tidy complain about these?
Found by manlio.perillo.
Fixes #6571

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/14608044
2013-10-11 16:39:40 -07:00
Rob Pike
beca0e124d doc/effective_go.html: fix a couple of cosmetic issues
At the moment, godoc expands the example in the link, but in
the past it has not. Add a waffle word to allow either possibility.
Also change the order of cases in the switch in Compare to
be consistent with the other switch in the function.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14439055
2013-10-10 17:26:03 -07:00
Andrew Gerrand
48ba6fe553 doc: move spec and memory model back to /ref/
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14364043
2013-10-04 09:45:06 +10:00
Rob Pike
d38ed2a9f2 doc/effective_go: fix server example that shares var between goroutines
Use it as a teaching example about how to solve this problem.

Fixes #6501

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/14250043
2013-10-02 11:35:25 -07:00
Andrew Gerrand
1f7c8a9aed doc: update links to spec and memory model
Fixes #6488.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14004043
2013-09-27 09:46:36 +10:00
Rob Pike
2a5dcfafec effective_go: add a discussion of labeled break and continue
Fixes #5725.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13705044
2013-09-17 07:41:45 +10:00
Rob Pike
38a77ff03f doc/effective_go.html: remove spurious word
Fixes #6003.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12387045
2013-08-05 11:24:27 +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
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
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
2f326da27e effective_go.html: be more accepting in the guidelines for interface names
Fixes #5421.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/9274043
2013-05-07 11:41:36 -07:00
Andrew Gerrand
48c4a87a94 doc: fix formatting in effective go code snippet
Fixes #5403.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/9100046
2013-05-03 15:24:05 -04:00
Shenghou Ma
ed19ab47c3 doc/effective_go.html: fix syntax error in code example
Fixes #5333.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8698046
2013-04-24 03:51:31 +08:00
Andrew Gerrand
994c486aa9 doc: fix typo in Effective Go
Fixes #5329.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8897044
2013-04-22 16:57:23 +02:00
Rob Pike
f29013d19b doc/effective_go: another doubled word
It's clear that that should never happen.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8798045
2013-04-16 13:59:10 -07:00
Shenghou Ma
86cd1d9e15 doc/effective_go.html: fix typo
Fixes #5296.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8682044
2013-04-17 04:41:28 +08:00
Elias Naur
c1786a9e3b doc: fix typo in effective_go.html
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7548045
2013-03-29 10:28:37 -07:00
Rob Pike
9dfcfb9385 effective_go.html: fix semaphore example
It didn't work properly according to the Go memory model.
Fixes #5023.

R=golang-dev, dvyukov, adg
CC=golang-dev
https://golang.org/cl/7698045
2013-03-12 10:53:01 -07:00
Rob Pike
33e8ca4d67 effective_go.html: add a section on type assertions
The information was missing, oddly enough.

R=golang-dev, rsc, iant
CC=golang-dev
https://golang.org/cl/7636044
2013-03-08 13:53:17 -08:00
Rob Pike
9e329a0d16 effective_go.html: move and rework the blank identifier section
Also rename the relevant examples and make sure the working one compiles.

R=golang-dev, bradfitz, adg, iant, rsc
CC=golang-dev
https://golang.org/cl/7597043
2013-03-08 10:41:20 -08:00
Rob Pike
45a3b3714f doc/effective_go.html: unify and expand the discussion of Sprintf and String
It's a common mistake to build a recursive String method; explain it well and
show how to avoid it.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/7486049
2013-03-06 15:47:49 -08:00
Rob Pike
5f07125cb9 effective_go.html: round 3 of minor edits.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7489044
2013-03-06 10:08:48 -08:00
Rob Pike
b3915112b9 doc/effective_go.html: update slices and maps.
Drop the phrase "reference types", which has caused confusion.
Add a section about 2D arrays, a common newbie question.

R=golang-dev, cespare, adg, rsc
CC=golang-dev
https://golang.org/cl/7423051
2013-03-05 14:13:53 -08:00
Rob Pike
6bfec725cf doc/effective_go.html: minor updates, part 1
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7454044
2013-02-28 16:57:55 -08:00
Rob Pike
fbec8347cb doc/effective_go.html: use correct name in Interface Checks section
Fixes #4897.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7377061
2013-02-27 14:42:53 -08:00
David Symonds
4101469ccc doc: adjust indentation in Effective Go commentary example.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7225080
2013-02-13 16:43:55 +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
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
Nigel Tao
3e2a888753 doc/effective_go: don't use ALL_CAPS for variable names.
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/6826070
2012-11-08 11:55:46 +11:00
Mikio Hara
b602c3dbbd all: clear execute bit
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6826044
2012-11-01 10:04:42 +09:00
Rob Pike
0cd0c3e8ca effective_go: s/usr/home/ in example
When I was a lad (and well past), users were in /usr;
now they're somewhere else, I'm told.
Kids today.

Fixes #4122.

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/6552060
2012-09-23 10:44:56 +10:00
Oling Cat
e93891f348 doc/effective_go: Closed some tags; removed extra spaces.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6488122
2012-09-18 08:50:24 -07:00
Rob Pike
f3fc0090f4 effective_go: use html/template instead of text/template
Should have done this a long time ago.
Fixes #3811.

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/6488120
2012-09-13 13:41:13 -07:00
Shenghou Ma
5b7562dd6f doc/progs: use test/run.go for testing on Windows
cgo[1-4].go, go1.go couldn't be tested now
(cgo[1-4].go can only be tested when cgo is enabled, go1.go
contain a list of filenames in the current directory)

R=golang-dev, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/6218048
2012-09-03 03:49:03 +08:00
Jongmin Kim
08f919f462 doc/effective_go.html: fixed the Request channel parameter
R=golang-dev, r
CC=golang-dev, gri
https://golang.org/cl/6010051
2012-04-13 15:22:40 +10:00
Aaron Kemp
cb871ce3e0 doc/effective_go.html: Add missing '...' for fmt.Sprintf()
The '...' was missing on a call to fmt.Sprintf() which would result in
the slice being printed instead of the correct result.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5967051
2012-03-30 17:51:24 -07:00
Rob Pike
4074795e15 effective_go: cleanups and fixes
Also explain the situation with recursive String methods more accurately,
and clean up the code now that the fmt package is more careful.

R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/5907047
2012-03-25 11:34:51 +11:00
Robert Griesemer
b8b308d184 doc/effective_go.html: undo local font change
R=r
CC=golang-dev
https://golang.org/cl/5876043
2012-03-21 14:29:16 -07:00
Shenghou Ma
0532f4d382 doc/effective_go: minor corrections
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5848063
2012-03-21 09:33:55 -07:00
Brad Fitzpatrick
e5102b35f6 doc: remove reference to deleted os.ENOSPC
R=golang-dev, gri, r, r
CC=golang-dev
https://golang.org/cl/5866046
2012-03-20 16:50:51 -07:00
David Symonds
e5cc09a75d doc: use time.Duration in Effective Go.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5841044
2012-03-16 14:27:11 +11:00
Russ Cox
a40065ac68 cmd/godoc: add support for serving templates
doc: convert to use godoc built-in templates

tmpltohtml is gone, to avoid having a second copy of the code.
Instead, godoc -url /doc/go1.html will print the actual HTML
served for that URL.  "make" will generate files named go1.rawhtml
etc, which can be fed through tidy.

It can be hard to tell from the codereview diffs, but all the
tmpl files have been renamed to be html files and then
have "Template": true added.

R=golang-dev, adg, r, gri
CC=golang-dev
https://golang.org/cl/5782046
2012-03-08 08:39:20 -05:00
Russ Cox
e8d1852d6a doc: update Effective Go init section
Goroutines are no longer excluded from init.

Fixes #3232.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5764044
2012-03-07 11:38:39 -05:00