1
0
mirror of https://github.com/golang/go synced 2024-11-05 15:26:15 -07:00
Commit Graph

129 Commits

Author SHA1 Message Date
Rob Pike
136c04f71a doc/go1: most of the simple language changes
R=rsc, adg, r
CC=golang-dev
https://golang.org/cl/5477044
2011-12-08 16:39:05 -08:00
Rob Pike
2fa987b6cd doc/go1: map deletion
This CL is in part a proposal for how to write these sections:
- Brief discussion of change
- No attempt to analyze the thinking about it
- Old code
- New code, runnable if possible
- How to update old programs

R=golang-dev, remyoudompheng, gri, adg
CC=golang-dev
https://golang.org/cl/5454044
2011-12-07 16:11:17 -08:00
Russ Cox
da5a251dde doc: do not slice array literal
The special case in the spec is that you can take the
address of a composite literal using the & operator.

A composite literal is not, however, generally addressable,
and the slice operator requires an addressable argument,
so [3]int{1,2,3}[:] is invalid.  This tutorial code and one bug
report are the only places in the tree where it appears.

R=r, gri
CC=golang-dev
https://golang.org/cl/5437120
2011-12-02 12:30:37 -05:00
Alex Brainman
36494b0acd doc/progs: fix windows version to satisfy new error
R=rsc
CC=golang-dev
https://golang.org/cl/5376089
2011-11-14 20:53:03 +11:00
Russ Cox
c017a8299f syscall: use error
- syscall (not os) now defines the Errno type.
- the low-level assembly functions Syscall, Syscall6, and so on
  return Errno, not uintptr
- syscall wrappers all return error, not uintptr.

R=golang-dev, mikioh.mikioh, r, alex.brainman
CC=golang-dev
https://golang.org/cl/5372080
2011-11-13 22:44:52 -05:00
Rob Pike
a50ee009f7 tutorial: describe unidirectional channels
R=golang-dev, adg, gri
CC=golang-dev
https://golang.org/cl/5370058
2011-11-10 14:02:14 -08:00
Rob Pike
f9489bed72 renaming_4: gofix -r everything/but/src/pkg
R=rsc
CC=golang-dev
https://golang.org/cl/5338043
2011-11-08 15:43:02 -08:00
Russ Cox
44526cdbe0 non-pkg: gofix -r error -force=error
R=golang-dev, iant, r, r
CC=golang-dev
https://golang.org/cl/5307066
2011-11-01 22:06:05 -04:00
Rob Pike
68050ac76b tutorial,effective_go: prepare for error change
R=adg, rsc
CC=golang-dev
https://golang.org/cl/5316068
2011-11-01 21:50:21 -04:00
Jaroslavas Počepko
ff866c4ca3 ld: Fixes issue 1899 ("cannot create 8.out.exe")
http://code.google.com/p/go/issues/detail?id=1899

R=rsc, alex.brainman, bsiegert, hectorchu, bradfitz
CC=golang-dev
https://golang.org/cl/4978047
2011-10-14 20:37:07 +01:00
Jaroslavas Počepko
2afc46f2b2 doc/progs: fix windows/amd64
R=rsc
CC=alex.brainman, golang-dev, vcc.163
https://golang.org/cl/4965050
2011-08-29 15:38:12 -04:00
Rob Pike
6731d47f99 effective go: fix erroneous quoting of ampersands that cropped up
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4937047
2011-08-23 13:54:29 +10:00
Rob Pike
18b21c720e effective go: extract and test a couple more examples.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4937045
2011-08-22 22:46:59 +10:00
Rob Pike
d1a3edaee7 effective_go: convert to use tmpltohtml.
Also update the big example to the new template system.
There are a number of other examples that should be
extracted; this CL serves as an introduction to the
approach.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4923043
2011-08-21 09:46:19 +10:00
Mikio Hara
ab3365d34e doc/progs: gofmt -w
R=r, gri, r
CC=golang-dev
https://golang.org/cl/4662085
2011-07-09 20:16:45 +10:00
Wei Guangjing
63b8b948d9 windows: define and use syscall.Handle
Fixes #1487.

R=rsc, alex.brainman, go.peter.90, mikioh.mikioh, mattn.jp
CC=golang-dev
https://golang.org/cl/4600042
2011-07-01 10:18:07 -04:00
Rob Pike
4b1170d2b1 sort: change IntArray etc. to IntSlice for better name hygiene.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4602054
2011-06-11 09:25:18 +10:00
Rob Pike
2ccd20a646 tutorial: replace the forever loops with finite counts in sieve programs.
Fixes #1742.
I hope.

Also this picks up an update to go_tutorial.html that should already have happened.

R=brainman, rsc, peterGo
CC=golang-dev
https://golang.org/cl/4452050
2011-04-27 09:59:27 -07:00
Rob Pike
23fc9c84bd tutorial: modernize the definition and use of Open.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/4446053
2011-04-18 10:51:40 -07:00
Rob Pike
6990bc124f doc/progs: make sure all programs compile and run
Fixes #1455.

R=rsc
CC=golang-dev
https://golang.org/cl/4079055
2011-01-31 14:41:36 -08:00
Rob Pike
80e25fc923 docs: float->float64 plus a couple of other tweaks.
R=rsc, gri
CC=golang-dev
https://golang.org/cl/3978042
2011-01-19 23:07:38 -05:00
Rob Pike
166b444a93 tutorial: make stdin, stdout, stderr work on Windows.
R=brainman
CC=golang-dev
https://golang.org/cl/4042042
2011-01-18 11:01:47 -08:00
Russ Cox
3a2ba994b6 build: add a few missing --no-print-directory
Reported by W. Michael Petullo <mike@flyn.org>

Fixes #1269.

R=r, r2
CC=golang-dev
https://golang.org/cl/3618041
2010-12-13 15:50:57 -05:00
Rob Pike
e3b6188ca2 tutorial: a couple of minor fixes.
Fixes #1333.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/3556041
2010-12-09 16:18:31 -05:00
Rob Pike
781462dc46 doc/tutorial: update for slice changes.
Awaiting the lower-bound change before checkin.

Fixes #1067.

R=rsc, iant, gri
CC=golang-dev
https://golang.org/cl/2105043
2010-09-10 13:53:18 +10:00
Christian Himpel
5c603dbb75 build: remove unnecessary references to GOBIN and GOROOT
All scripts and makefiles assume that GOBIN is correctly set
in PATH.

R=rsc
CC=golang-dev
https://golang.org/cl/2043041
2010-08-30 15:40:56 -04:00
Russ Cox
da392d9136 build: no required environment variables
R=adg, r, PeterGo
CC=golang-dev
https://golang.org/cl/1942044
2010-08-18 10:08:49 -04:00
Rob Pike
e45b58fe96 os: change the type of permissions argument for Open etc. to uint32.
Besides being more correct, it protects against people accidentally
exchanging the permission and open mode arguments to Open.

R=rsc
CC=golang-dev
https://golang.org/cl/1904045
2010-08-04 08:34:52 +10:00
Russ Cox
00f9f0c056 single argument panic
note that sortmain.go has been run through hg gofmt;
only the formatting of the day initializers changed.
i'm happy to revert that formatting if you'd prefer.

stop on error in doc/progs/run

R=r
CC=golang-dev
https://golang.org/cl/850041
2010-03-30 10:34:57 -07:00
Christopher Wedgwood
5de2e1c5bb doc: Use byte("...") over byte{...}
R=rsc, r
CC=golang-dev
https://golang.org/cl/224069
2010-02-25 20:06:41 -08:00
Rob Pike
34356e9a6a update tutorial.
R=rsc
CC=golang-dev
https://golang.org/cl/179063
2009-12-16 10:29:53 +11:00
Devon H. O'Dell
857d4cf1a9 Remove GOBIN in PATH dependency; don't assume cwd is $GOROOT/src
This change removes the necessity to have GOBIN in $PATH,
and also doesn't assume that the build is being run from
$GOROOT/src. This is a minimal set of necessary changes
to get Go to build happily from the FreeBSD ports
collection.

R=rsc
CC=golang-dev
https://golang.org/cl/171044
2009-12-11 15:14:09 -08:00
Sergio Luis O. B. Correia
6fc820729e go: makes it build for the case $GOROOT has whitespaces
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.

this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.

Fixes #115.

R=rsc, dsymonds1
https://golang.org/cl/157067
2009-11-23 17:32:51 -08:00
Russ Cox
43bcf47912 make all.bash finish on FreeBSD
R=dho
CC=golang-dev
https://golang.org/cl/156067
2009-11-18 09:11:17 -08:00
Rob Pike
9549eeecd1 add a paragraph about semicolons to the tutorial.
fix a typo caught by kakugawa@gmail.com

Fixes #92.

R=rsc
CC=golang-dev
https://golang.org/cl/152105
2009-11-12 14:10:16 -08:00
Russ Cox
898714a92f tutorial fixes
R=r
CC=go-dev
http://go/go-review/1024014
2009-11-07 18:05:30 -08:00
Rob Pike
83f0b718ed fixups in the tutorial
also add a section about compiling programs because some found it surprising not to have one

R=rsc
CC=go-dev
http://go/go-review/1018011
2009-11-01 20:47:03 -08:00
Russ Cox
a68592a4dd excise some internal references.
R=r
DELTA=209  (65 added, 114 deleted, 30 changed)
OCL=35718
CL=35721
2009-10-14 13:02:05 -07:00
Rob Pike
400fa1c893 align the tutorial with the renaming of SortInterface.
fix a bug in makehtml - was deleting the output!

R=rsc
DELTA=11  (2 added, 0 deleted, 9 changed)
OCL=35672
CL=35674
2009-10-13 13:05:42 -07:00
Rob Pike
7839521335 Automated g4 rollback of changelist 35383.
*** Reason for rollback ***

roll back the changes to the tutorial programs (only) since they
break the automated processing used to create the tutorial.

*** Original change description ***

apply gofmt to the LGTM-marked files from 34501
that have not changed since I applied gofmt.

R=rsc
DELTA=139  (0 added, 44 deleted, 95 changed)
OCL=35670
CL=35670
2009-10-13 12:37:04 -07:00
Russ Cox
650bff6aa9 another round of gofmt applications
R=gri
DELTA=900  (106 added, 31 deleted, 763 changed)
OCL=35384
CL=35396
2009-10-06 14:55:39 -07:00
Russ Cox
c62b3265a7 apply gofmt to the LGTM-marked files from 34501
that have not changed since I applied gofmt.

R=gri
DELTA=456  (77 added, 3 deleted, 376 changed)
OCL=35378
CL=35383
2009-10-06 11:42:55 -07:00
Russ Cox
ae54cf73ca last round: non-package code
R=r
DELTA=127  (38 added, 3 deleted, 86 changed)
OCL=34640
CL=34650
2009-09-15 12:42:24 -07:00
Russ Cox
28eba4877b fix "declared and not used" errors in non-test code.
R=r
DELTA=112  (6 added, 57 deleted, 49 changed)
OCL=34610
CL=34610
2009-09-14 17:20:29 -07:00
Rob Pike
61028773b1 update tutorial
R=rsc
DELTA=30  (5 added, 0 deleted, 25 changed)
OCL=33138
CL=33170
2009-08-13 08:54:26 -07:00
Russ Cox
a0bcaf4c00 Change os.Error convention:
echo back context of call in error if likely to be useful.

For example, if os.Open("/etc/passwd", os.O_RDONLY)
fails with syscall.EPERM, it returns as the os.Error

	&PathError{
		Op: "open",
		Path: "/etc/passwd"
		Error: os.EPERM
	}

which formats as

	open /etc/passwd: permission denied

Not converted:

	datafmt
	go/...
	google/...
	regexp
	tabwriter
	template

R=r
DELTA=1153  (561 added, 156 deleted, 436 changed)
OCL=30738
CL=30781
2009-06-25 20:24:55 -07:00
Russ Cox
cf370a6206 add ./ to imports where necessary
R=r
DELTA=51  (4 added, 4 deleted, 43 changed)
OCL=30759
CL=30778
2009-06-25 20:13:56 -07:00
Russ Cox
6609d2f88d restructure makefiles, scripts to factor out O= logic.
remove a few hardcoded paths elsewhere too.

R=r,gri
DELTA=123  (44 added, 15 deleted, 64 changed)
OCL=29914
CL=29945
2009-06-05 10:59:55 -07:00
Russ Cox
9e0fec9c9c update Go tree to use new syscall package.
R=r
DELTA=713  (109 added, 386 deleted, 218 changed)
OCL=29707
CL=29722
2009-06-01 22:14:39 -07:00
Russ Cox
918afd9491 move things out of sys into os and runtime
R=r
OCL=28569
CL=28573
2009-05-08 15:21:41 -07:00
Rob Pike
aaf63f8d06 Step 1 of the Big Error Shift: make os.Error an interface and replace *os.Errors with os.Errors.
lib/template updated to use new setup; its clients also updated.

Step 2 will make os's error support internally much cleaner.

R=rsc
OCL=27586
CL=27586
2009-04-17 00:08:24 -07:00
Russ Cox
60ce95d7a1 code changes for array conversion.
as a reminder, the old conversion
was that you could write

	var arr [10]byte;
	var slice []byte;
	slice = arr;

but now you have to write

	slice = &arr;

the change eliminates an implicit &, so that
the only implicit &s left are in the . operator
and in string(arr).

also, removed utf8.EncodeRuneToString
in favor of string(rune).

R=r
DELTA=83  (1 added, 23 deleted, 59 changed)
OCL=27531
CL=27534
2009-04-15 20:27:45 -07:00
Rob Pike
bdbb3b455e remove print() from the tutorial, generating a little clumsiness around "import"
R=rsc,gri
DELTA=103  (36 added, 33 deleted, 34 changed)
OCL=26442
CL=26491
2009-03-18 14:09:16 -07:00
Rob Pike
e9f4fb2839 change the tutorial to use File, file rather than FD, fd.
also make the default input for makehtml be go_tutorial.txt.

R=rsc
DELTA=176  (58 added, 58 deleted, 60 changed)
OCL=26374
CL=26374
2009-03-16 22:53:23 -07:00
Russ Cox
be2edb5761 Automated g4 rollback of changelist 25024,
plus significant hand editing.

Back to T{x} for composite literals.

R=r
OCL=25612
CL=25632
2009-03-03 08:39:12 -08:00
Russ Cox
9f8f2e6130 convert composite literals from { } to ( ).
only non-trivial changes are in
	convlit1.go
	golden.out

R=gri
OCL=25019
CL=25024
2009-02-13 14:48:32 -08:00
Rob Pike
25a2b3626d needless semicolons
R=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=23967
CL=23970
2009-01-30 15:10:22 -08:00
Russ Cox
4cf7711568 update go code tree to new func rules.
R=r
DELTA=367  (111 added, 59 deleted, 197 changed)
OCL=23957
CL=23960
2009-01-30 14:39:31 -08:00
Rob Pike
b59dbd7fe0 rename variable at rsc's request
R=rsc
DELTA=4  (0 added, 0 deleted, 4 changed)
OCL=23896
CL=23928
2009-01-30 11:14:48 -08:00
Rob Pike
96777ea2a7 clean up server code in tutorial
R=rsc
DELTA=15  (1 added, 0 deleted, 14 changed)
OCL=23889
CL=23889
2009-01-30 10:18:58 -08:00
Rob Pike
ae05f00b46 update tutorial for new export scheme
R=ken,rsc
DELTA=101  (9 added, 0 deleted, 92 changed)
OCL=23174
CL=23188
2009-01-20 19:32:36 -08:00
Russ Cox
839a68469b delete export
TBR=r
OCL=23121
CL=23127
2009-01-20 14:40:40 -08:00
Russ Cox
360962420c casify, cleanup sys
R=r
OCL=22978
CL=22984
2009-01-16 14:58:14 -08:00
Rob Pike
1a91b9a8a9 casify syscall and sequelae
R=rsc
DELTA=337  (0 added, 1 deleted, 336 changed)
OCL=22950
CL=22950
2009-01-16 11:36:44 -08:00
Rob Pike
293c8f8c65 casify tutorial examples
will bring document in line in a later CL, which may include revisiting some of the names

R=rsc
DELTA=58  (0 added, 0 deleted, 58 changed)
OCL=22906
CL=22908
2009-01-15 17:54:07 -08:00
Rob Pike
61f3302044 printf->Printf etc.
the raw fmt routines will be another, smaller but subtler pass.

R=rsc
DELTA=157  (0 added, 0 deleted, 157 changed)
OCL=22851
CL=22851
2009-01-15 13:48:11 -08:00
Rob Pike
ef51f4baf4 restore "os" identifier to keep consistent with text.
R=presotto
OCL=22733
CL=22733
2009-01-14 08:43:32 -08:00
Rob Pike
40d5435278 update tutorial to new language.
add a section on printing
add a section on allocation

R=rsc
DELTA=500  (278 added, 15 deleted, 207 changed)
OCL=22381
CL=22456
2009-01-09 15:16:31 -08:00
Ian Lance Taylor
dfc3e52310 Use make instead of new to allocate a channel.
R=r
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=22452
CL=22455
2009-01-09 15:13:26 -08:00
Rob Pike
8d21004b41 make the tutorial programs run again.
(the text still needs fixing)
add the tutorial programs to the test run.

R=rsc
DELTA=41  (6 added, 0 deleted, 35 changed)
OCL=22174
CL=22174
2009-01-06 15:49:27 -08:00
Rob Pike
81672ef15b fix some typos, mostly
R=gri
OCL=16161
CL=16161
2008-09-29 20:06:48 -07:00
Rob Pike
f7a506bf42 tutorial code:
tweak a program or two
delete unused programs
add shell script to run them all

R=gri
DELTA=213  (62 added, 147 deleted, 4 changed)
OCL=15435
CL=15437
2008-09-17 12:14:52 -07:00
Rob Pike
592d2e3d8d update to new communications syntax
R=gri
OCL=15417
CL=15417
2008-09-16 19:40:38 -07:00
Rob Pike
6820196b75 section on service multiplexing
R=gri
DELTA=75  (57 added, 4 deleted, 14 changed)
OCL=15394
CL=15398
2008-09-16 13:14:44 -07:00
Rob Pike
db9002f152 replace 235 with sieve - less problematic
add programs, not yet described, to demonstrate servers.

R=gri
DELTA=279  (177 added, 16 deleted, 86 changed)
OCL=15380
CL=15389
2008-09-16 11:00:11 -07:00
Rob Pike
a43033a315 develop interfaces through cats
sort
2,3,5

R=gri
DELTA=648  (647 added, 0 deleted, 1 changed)
OCL=15315
CL=15352
2008-09-15 11:48:37 -07:00
Rob Pike
6693730e77 next section: i/o package that has structs, methods
R=gri
DELTA=137  (134 added, 0 deleted, 3 changed)
OCL=15251
CL=15259
2008-09-12 16:03:16 -07:00
Rob Pike
c7ebfed655 add sections about types and constants
R=gri
DELTA=133  (124 added, 0 deleted, 9 changed)
OCL=15122
CL=15143
2008-09-11 10:21:02 -07:00
Rob Pike
27a56171c9 growing the tutorial
R=gri
OCL=15115
CL=15115
2008-09-10 17:11:04 -07:00