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:
Rob Pike 2011-02-11 16:06:41 -08:00
Родитель 9d0000ebb5
Коммит 4202e4deaf
2 изменённых файлов: 6 добавлений и 6 удалений

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.
}