update the README code annotations, make it more clear

This commit is contained in:
salamer 2018-08-18 23:37:47 +08:00
parent e51d726b33
commit 47a973a90e

View File

@ -908,12 +908,13 @@ func main() {
r.GET("/someProtoBuf", func(c *gin.Context) {
reps := []int64{int64(1), int64(2)}
label := "test"
// Proto specifically defines the testdata/protoexample file
// The specific definition of protobuf is written in the testdata/protoexample file.
data := &protoexample.Test{
Label: &label,
Reps: reps,
}
// Note that data becomes binary data in the response
// Will output protoexample.Test protobuf serialized data
c.ProtoBuf(http.StatusOK, data)
})