summaryrefslogtreecommitdiff
path: root/doc/progs
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-04-15 20:27:45 -0700
committerRuss Cox <rsc@golang.org>2009-04-15 20:27:45 -0700
commit0ada410ece61f805c66b63eb15bb8584c3e584cd (patch)
tree16cfcc3cc7d82aa01da1b152e520297da5afc88a /doc/progs
parent398d9c9582bcde24740e65cc4e5c9b97c5bcac40 (diff)
downloadgolang-0ada410ece61f805c66b63eb15bb8584c3e584cd.tar.gz
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
Diffstat (limited to 'doc/progs')
-rw-r--r--doc/progs/cat.go2
-rw-r--r--doc/progs/cat_rot13.go2
-rw-r--r--doc/progs/sum.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/doc/progs/cat.go b/doc/progs/cat.go
index c06a730ce..1f6c0f9df 100644
--- a/doc/progs/cat.go
+++ b/doc/progs/cat.go
@@ -15,7 +15,7 @@ func cat(f *file.File) {
const NBUF = 512;
var buf [NBUF]byte;
for {
- switch nr, er := f.Read(buf); true {
+ switch nr, er := f.Read(&buf); true {
case nr < 0:
fmt.Fprintf(os.Stderr, "error reading from %s: %s\n", f.String(), er.String());
sys.Exit(1);
diff --git a/doc/progs/cat_rot13.go b/doc/progs/cat_rot13.go
index 618ae9111..aba8b4c7f 100644
--- a/doc/progs/cat_rot13.go
+++ b/doc/progs/cat_rot13.go
@@ -57,7 +57,7 @@ func cat(r reader) {
r = newRotate13(r)
}
for {
- switch nr, er := r.Read(buf); {
+ switch nr, er := r.Read(&buf); {
case nr < 0:
fmt.Fprintf(os.Stderr, "error reading from %s: %s\n", r.String(), er.String());
sys.Exit(1);
diff --git a/doc/progs/sum.go b/doc/progs/sum.go
index 19600af06..f087ca3e5 100644
--- a/doc/progs/sum.go
+++ b/doc/progs/sum.go
@@ -16,6 +16,6 @@ func sum(a []int) int { // returns an int
func main() {
- s := sum([3]int{1,2,3}); // a slice of the array is passed to sum
+ s := sum(&[3]int{1,2,3}); // a slice of the array is passed to sum
fmt.Print(s, "\n");
}