зеркало из https://github.com/golang/protobuf.git
goprotobuf/README: update example to reflect name change in log package
R=dsymonds CC=golang-dev http://codereview.appspot.com/4169049
This commit is contained in:
Родитель
9d0000ebb5
Коммит
4202e4deaf
6
README
6
README
|
@ -147,16 +147,16 @@ To create and play with a Test object from the example package,
|
|||
}
|
||||
data, err := proto.Marshal(test)
|
||||
if err != nil {
|
||||
log.Exit("marshaling error:", err)
|
||||
log.Fatal("marshaling error: ", err)
|
||||
}
|
||||
newTest := &example.Test{}
|
||||
err = proto.Unmarshal(data, newTest)
|
||||
if err != nil {
|
||||
log.Exit("unmarshaling error:", err)
|
||||
log.Fatal("unmarshaling error: ", err)
|
||||
}
|
||||
// Now test and newTest contain the same data.
|
||||
if proto.GetString(test.Label) != proto.GetString(newTest.Label) {
|
||||
log.Exit("data mismatch %q %q", proto.GetString(test.Label), proto.GetString(newTest.Label))
|
||||
log.Fatalf("data mismatch %q != %q", proto.GetString(test.Label), proto.GetString(newTest.Label))
|
||||
}
|
||||
// etc.
|
||||
}
|
||||
|
|
|
@ -145,16 +145,16 @@
|
|||
}
|
||||
data, err := proto.Marshal(test)
|
||||
if err != nil {
|
||||
log.Exit("marshaling error:", err)
|
||||
log.Fatal("marshaling error: ", err)
|
||||
}
|
||||
newTest := new(example.Test)
|
||||
err = proto.Unmarshal(data, newTest)
|
||||
if err != nil {
|
||||
log.Exit("unmarshaling error:", err)
|
||||
log.Fatal("unmarshaling error: ", err)
|
||||
}
|
||||
// Now test and newTest contain the same data.
|
||||
if proto.GetString(test.Label) != proto.GetString(newTest.Label) {
|
||||
log.Exit("data mismatch %q %q", proto.GetString(test.Label), proto.GetString(newTest.Label))
|
||||
log.Fatalf("data mismatch %q != %q", proto.GetString(test.Label), proto.GetString(newTest.Label))
|
||||
}
|
||||
// etc.
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче