Remove erroneous default eliding in enc_slice_byte.
R=r
CC=golang-dev, mkrautz
http://codereview.appspot.com/3353041
diff --git a/proto/all_test.go b/proto/all_test.go
index 4125c09..03f5369 100644
--- a/proto/all_test.go
+++ b/proto/all_test.go
@@ -552,6 +552,7 @@
"fd02e0659948"+ // field 47, encoding 5, value 314159.0
"81030000000050971041"+ // field 48, encoding 1, value 271828.0
"8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
+ "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
"90193f"+ // field 402, encoding 0, value 63
"98197f"+ // field 403, encoding 0, value 127
"b304"+ // start group field 70 level 1
@@ -603,6 +604,7 @@
"fd02e0659948"+ // field 47, encoding 5, value 314159.0
"81030000000050971041"+ // field 48, encoding 1, value 271828.0
"8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
+ "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
"90193f"+ // field 402, encoding 0, value 63
"98197f"+ // field 403, encoding 0, value 127
"b304"+ // start group field 70 level 1
@@ -674,6 +676,7 @@
"fd02e0659948"+ // field 47, encoding 5, value 314159.0
"81030000000050971041"+ // field 48, encoding 1, value 271828.0
"8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
+ "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
"90193f"+ // field 402, encoding 0, value 63
"98197f"+ // field 403, encoding 0, value 127
"b304"+ // start group field 70 level 1
@@ -758,6 +761,7 @@
"fd02e0659948"+ // field 47, encoding 5, value 314159.0
"81030000000050971041"+ // field 48, encoding 1, value 271828.0
"8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
+ "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
"90193f"+ // field 402, encoding 0, value 63
"98197f"+ // field 403, encoding 0, value 127
"b304"+ // start group field 70 level 1
diff --git a/proto/encode.go b/proto/encode.go
index b5e0b67..37c572c 100644
--- a/proto/encode.go
+++ b/proto/encode.go
@@ -367,23 +367,6 @@
if s == nil {
return ErrNil
}
- // TODO: remove this block and fix tests
- if !p.Required {
- l := len(s)
- // check default
- if l > 0 && l == len(p.Default) {
- same := true
- for i := 0; i < len(p.Default); i++ {
- if p.Default[i] != s[i] {
- same = false
- break
- }
- }
- if same {
- return ErrNil
- }
- }
- }
o.buf = bytes.Add(o.buf, p.tagcode)
o.EncodeRawBytes(s)
return nil