Просмотр исходного кода

goprotobuf: gofmt -s

R=dsymonds
CC=golang-dev
https://codereview.appspot.com/8439044
Albert Strasheim 12 лет назад
Родитель
Сommit
4676f6a694
4 измененных файлов с 18 добавлено и 18 удалено
  1. 1 1
      proto/all_test.go
  2. 7 7
      proto/clone_test.go
  3. 4 4
      proto/properties.go
  4. 6 6
      proto/text_parser_test.go

+ 1 - 1
proto/all_test.go

@@ -1158,7 +1158,7 @@ func TestPackedNonPackedDecoderSwitching(t *testing.T) {
 func TestProto1RepeatedGroup(t *testing.T) {
 	pb := &MessageList{
 		Message: []*MessageList_Message{
-			&MessageList_Message{
+			{
 				Name:  String("blah"),
 				Count: Int32(7),
 			},

+ 7 - 7
proto/clone_test.go

@@ -49,7 +49,7 @@ var cloneTestMessage = &pb.MyMessage{
 		Connected: proto.Bool(true),
 	},
 	Others: []*pb.OtherMessage{
-		&pb.OtherMessage{
+		{
 			Value: []byte("some bytes"),
 		},
 	},
@@ -111,7 +111,7 @@ var mergeTests = []struct {
 			},
 			Pet: []string{"horsey"},
 			Others: []*pb.OtherMessage{
-				&pb.OtherMessage{
+				{
 					Value: []byte("some bytes"),
 				},
 			},
@@ -123,10 +123,10 @@ var mergeTests = []struct {
 			},
 			Pet: []string{"bunny", "kitty"},
 			Others: []*pb.OtherMessage{
-				&pb.OtherMessage{
+				{
 					Key: proto.Int64(31415926535),
 				},
-				&pb.OtherMessage{
+				{
 					// Explicitly test a src=nil field
 					Inner: nil,
 				},
@@ -140,11 +140,11 @@ var mergeTests = []struct {
 			},
 			Pet: []string{"bunny", "kitty", "horsey"},
 			Others: []*pb.OtherMessage{
-				&pb.OtherMessage{
+				{
 					Key: proto.Int64(31415926535),
 				},
-				&pb.OtherMessage{},
-				&pb.OtherMessage{
+				{},
+				{
 					Value: []byte("some bytes"),
 				},
 			},

+ 4 - 4
proto/properties.go

@@ -252,14 +252,14 @@ func (p *Properties) Parse(s string) {
 		case f == "packed":
 			p.Packed = true
 		case strings.HasPrefix(f, "name="):
-			p.OrigName = f[5:len(f)]
+			p.OrigName = f[5:]
 		case strings.HasPrefix(f, "enum="):
-			p.Enum = f[5:len(f)]
+			p.Enum = f[5:]
 		case strings.HasPrefix(f, "def="):
-			p.Default = f[4:len(f)] // rest of string
+			p.Default = f[4:] // rest of string
 			if i+1 < len(fields) {
 				// Commas aren't escaped, and def is always last.
-				p.Default += "," + strings.Join(fields[i+1:len(fields)], ",")
+				p.Default += "," + strings.Join(fields[i+1:], ",")
 				break
 			}
 		}

+ 6 - 6
proto/text_parser_test.go

@@ -261,10 +261,10 @@ var unMarshalTextTests = []UnmarshalTextTest{
 		out: &MyMessage{
 			Count: Int32(42),
 			Others: []*OtherMessage{
-				&OtherMessage{},
-				&OtherMessage{},
-				&OtherMessage{},
-				&OtherMessage{},
+				{},
+				{},
+				{},
+				{},
 			},
 		},
 	},
@@ -373,11 +373,11 @@ var unMarshalTextTests = []UnmarshalTextTest{
 				Connected: Bool(true),
 			},
 			Others: []*OtherMessage{
-				&OtherMessage{
+				{
 					Key:   Int64(3735928559),
 					Value: []byte{0x1, 'A', '\a', '\f'},
 				},
-				&OtherMessage{
+				{
 					Weight: Float32(58.9),
 					Inner: &InnerMessage{
 						Host: String("lesha.mtv"),