github.com/tsuna/gohbase@v0.0.0-20250731002811-4ffcadfba63e/pb/marshal.go (about) 1 // Copyright (C) 2015 The GoHBase Authors. All rights reserved. 2 // This file is part of GoHBase. 3 // Use of this source code is governed by the Apache License 2.0 4 // that can be found in the COPYING file. 5 6 package pb 7 8 import ( 9 "google.golang.org/protobuf/proto" 10 ) 11 12 // MustMarshal is like proto.Marshal except it panic()'s if the protobuf 13 // couldn't be serialized. 14 func MustMarshal(pb proto.Message) []byte { 15 b, err := proto.Marshal(pb) 16 if err != nil { 17 panic(err) 18 } 19 return b 20 }