ruiaylin / goprotobuf

Automatically exported from code.google.com/p/goprotobuf
Other
0 stars 0 forks source link

XxxMessage.String() ends with a space #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
example.proto:

package main;

message Example {
    optional int32 a = 1;
}

main.go:

package main

import (
    "code.google.com/p/goprotobuf/proto"
    "fmt"
)

func main() {
    t := &Example{A: proto.Int32(1)}
    fmt.Printf("{BEGIN}%v{END}\n", t)
}

protoc --go_out=. example.proto
go run main.go example.pb.go

Output:
{BEGIN}a:1 {END}

I need:
{BEGIN}a:1{END}

Original issue reported on code.google.com by chaishus...@gmail.com on 7 May 2013 at 6:34

Attachments:

GoogleCodeExporter commented 9 years ago
I'm not sure it's actually a problem. The trailing space is most likely just 
there because it made the code simpler, but it's still valid output, and spaces 
are easy to trim if they bother you.

Original comment by dsymo...@golang.org on 7 May 2013 at 12:49

GoogleCodeExporter commented 9 years ago

Original comment by dsymo...@golang.org on 7 Jun 2013 at 11:44