throughout: replace bytes.Add and bytes.AddByte with calls to append

R=gri
CC=golang-dev
http://codereview.appspot.com/3418041
diff --git a/compiler/generator/generator.go b/compiler/generator/generator.go
index 1a7ba8f..f6b6c25 100644
--- a/compiler/generator/generator.go
+++ b/compiler/generator/generator.go
@@ -1059,12 +1059,10 @@
 		return ""
 	}
 	t := make([]byte, 0, 32)
-	oneC := make([]byte, 1)
 	i := 0
 	if s[0] == '_' {
 		// Need a capital letter; drop the '_'.
-		oneC[0] = 'X'
-		t = bytes.Add(t, oneC)
+		t = append(t, 'X')
 		i++
 	}
 	// Invariant: if the next letter is lower case, it must be converted
@@ -1073,25 +1071,23 @@
 	// upper case letter. Digits are treated as words.
 	for ; i < len(s); i++ {
 		c := s[i]
-		oneC[0] = c
 		if c == '_' && i+1 < len(s) && isASCIILower(s[i+1]) {
 			continue // Skip the underscore in s.
 		}
 		if isASCIIDigit(c) {
-			t = bytes.Add(t, oneC)
+			t = append(t, c)
 			continue
 		}
 		// Assume we have a letter now - if not, it's a bogus identifier.
 		// The next word is a sequence of characters that must start upper case.
 		if isASCIILower(c) {
-			oneC[0] ^= ' ' // Make it a capital letter.
+			c ^= ' ' // Make it a capital letter.
 		}
-		t = bytes.Add(t, oneC) // Guaranteed not lower case.
+		t = append(t, c) // Guaranteed not lower case.
 		// Accept lower case sequence that follows.
 		for i+1 < len(s) && isASCIILower(s[i+1]) {
 			i++
-			oneC[0] = s[i]
-			t = bytes.Add(t, oneC)
+			t = append(t, s[i])
 		}
 	}
 	return string(t)
diff --git a/proto/decode.go b/proto/decode.go
index 5423895..4eff414 100644
--- a/proto/decode.go
+++ b/proto/decode.go
@@ -36,7 +36,6 @@
  */
 
 import (
-	"bytes"
 	"fmt"
 	"io"
 	"os"
@@ -240,7 +239,7 @@
 
 	o.buf = *ptr
 	o.EncodeVarint(uint64(tag<<3 | wire))
-	*ptr = bytes.Add(o.buf, obuf[oi:o.index])
+	*ptr = append(o.buf, obuf[oi:o.index]...)
 
 	o.buf = obuf
 
@@ -359,7 +358,7 @@
 			iv := unsafe.Unreflect(t, unsafe.Pointer(&o.ptr))
 			if e, ok := iv.(extendableProto); ok && isExtensionField(e, int32(tag)) {
 				if err = o.skip(st, tag, wire); err == nil {
-					e.ExtensionMap()[int32(tag)] = bytes.Add(nil, o.buf[oi:o.index])
+					e.ExtensionMap()[int32(tag)] = append([]byte(nil), o.buf[oi:o.index]...)
 				}
 				continue
 			}
diff --git a/proto/encode.go b/proto/encode.go
index 13fd835..d7a5605 100644
--- a/proto/encode.go
+++ b/proto/encode.go
@@ -36,7 +36,6 @@
  */
 
 import (
-	"bytes"
 	"os"
 	"reflect"
 	"runtime"
@@ -175,7 +174,7 @@
 func (p *Buffer) EncodeRawBytes(b []byte) os.Error {
 	lb := len(b)
 	p.EncodeVarint(uint64(lb))
-	p.buf = bytes.Add(p.buf, b)
+	p.buf = append(p.buf, b...)
 	return nil
 }
 
@@ -219,7 +218,7 @@
 		if err != nil {
 			return err
 		}
-		p.buf = bytes.Add(p.buf, data)
+		p.buf = append(p.buf, data...)
 		return nil
 	}
 
@@ -249,7 +248,7 @@
 	if x != 0 {
 		x = 1
 	}
-	o.buf = bytes.Add(o.buf, p.tagcode)
+	o.buf = append(o.buf, p.tagcode...)
 	p.valEnc(o, uint64(x))
 	return nil
 }
@@ -261,7 +260,7 @@
 		return ErrNil
 	}
 	x := *v
-	o.buf = bytes.Add(o.buf, p.tagcode)
+	o.buf = append(o.buf, p.tagcode...)
 	p.valEnc(o, uint64(x))
 	return nil
 }
@@ -273,7 +272,7 @@
 		return ErrNil
 	}
 	x := *v
-	o.buf = bytes.Add(o.buf, p.tagcode)
+	o.buf = append(o.buf, p.tagcode...)
 	p.valEnc(o, uint64(x))
 	return nil
 }
@@ -285,7 +284,7 @@
 		return ErrNil
 	}
 	x := *v
-	o.buf = bytes.Add(o.buf, p.tagcode)
+	o.buf = append(o.buf, p.tagcode...)
 	o.EncodeStringBytes(x)
 	return nil
 }
@@ -302,7 +301,7 @@
 		if err != nil {
 			return err
 		}
-		o.buf = bytes.Add(o.buf, p.tagcode)
+		o.buf = append(o.buf, p.tagcode...)
 		o.EncodeRawBytes(data)
 		return nil
 	}
@@ -326,7 +325,7 @@
 		o.buffree(nbuf)
 		return err
 	}
-	o.buf = bytes.Add(o.buf, p.tagcode)
+	o.buf = append(o.buf, p.tagcode...)
 	o.EncodeRawBytes(nbuf)
 	o.buffree(nbuf)
 	return nil
@@ -358,7 +357,7 @@
 		return ErrNil
 	}
 	for _, x := range s {
-		o.buf = bytes.Add(o.buf, p.tagcode)
+		o.buf = append(o.buf, p.tagcode...)
 		if x != 0 {
 			x = 1
 		}
@@ -391,7 +390,7 @@
 	if s == nil {
 		return ErrNil
 	}
-	o.buf = bytes.Add(o.buf, p.tagcode)
+	o.buf = append(o.buf, p.tagcode...)
 	o.EncodeRawBytes(s)
 	return nil
 }
@@ -404,7 +403,7 @@
 		return ErrNil
 	}
 	for i := 0; i < l; i++ {
-		o.buf = bytes.Add(o.buf, p.tagcode)
+		o.buf = append(o.buf, p.tagcode...)
 		x := s[i]
 		p.valEnc(o, uint64(x))
 	}
@@ -438,7 +437,7 @@
 		return ErrNil
 	}
 	for i := 0; i < l; i++ {
-		o.buf = bytes.Add(o.buf, p.tagcode)
+		o.buf = append(o.buf, p.tagcode...)
 		x := s[i]
 		p.valEnc(o, uint64(x))
 	}
@@ -472,7 +471,7 @@
 		return ErrNil
 	}
 	for i := 0; i < l; i++ {
-		o.buf = bytes.Add(o.buf, p.tagcode)
+		o.buf = append(o.buf, p.tagcode...)
 		s := ss[i]
 		o.EncodeRawBytes(s)
 	}
@@ -484,7 +483,7 @@
 	ss := *(*[]string)(unsafe.Pointer(base + p.offset))
 	l := len(ss)
 	for i := 0; i < l; i++ {
-		o.buf = bytes.Add(o.buf, p.tagcode)
+		o.buf = append(o.buf, p.tagcode...)
 		s := ss[i]
 		o.EncodeStringBytes(s)
 	}
@@ -513,7 +512,7 @@
 			if err != nil {
 				return err
 			}
-			o.buf = bytes.Add(o.buf, p.tagcode)
+			o.buf = append(o.buf, p.tagcode...)
 			o.EncodeRawBytes(data)
 			continue
 		}
@@ -533,7 +532,7 @@
 			}
 			return err
 		}
-		o.buf = bytes.Add(o.buf, p.tagcode)
+		o.buf = append(o.buf, p.tagcode...)
 		o.EncodeRawBytes(nbuf)
 
 		o.buffree(nbuf)
@@ -574,7 +573,7 @@
 func (o *Buffer) enc_map(p *Properties, base uintptr) os.Error {
 	v := *(*map[int32][]byte)(unsafe.Pointer(base + p.offset))
 	for _, b := range v {
-		o.buf = bytes.Add(o.buf, b)
+		o.buf = append(o.buf, b...)
 	}
 	return nil
 }