rename from old code

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-21 22:21:22 -05:00
parent 273c0f5451
commit ec178de1d7
2 changed files with 7 additions and 12 deletions

View File

@ -14,24 +14,19 @@ import pb "go.wit.com/lib/protobuf/virtbuf"
// //
func main() { func main() {
TestWriteEvent() TestWriteDroplet()
in, err := ioutil.ReadFile("/tmp/testing4.protobuf") in, err := ioutil.ReadFile("/tmp/testing4.protobuf")
if err != nil { if err != nil {
log.Fatalln("Error reading file:", err) log.Fatalln("Error reading file:", err)
} }
var allEvents pb.Droplet var aDroplet pb.Droplet
if err := proto.Unmarshal(in, &allEvents); err != nil { if err := proto.Unmarshal(in, &aDroplet); err != nil {
log.Fatalln("Failed to parse events:", err) log.Fatalln("Failed to parse droplet:", err)
} }
// listPeople(os.Stdout, allEvents) log.Println(aDroplet)
// got := in.String()
log.Println(allEvents)
//for i, d := range allEvents {
// log.Println("i =", i, "d =", d)
//}
} }
func marshalWriteToFile(myWriter *bufio.Writer, e *pb.Droplet) { func marshalWriteToFile(myWriter *bufio.Writer, e *pb.Droplet) {
@ -49,7 +44,7 @@ func marshalWriteToFile(myWriter *bufio.Writer, e *pb.Droplet) {
log.Println("bufio.Write() tmp2, err = ", tmp2, err) log.Println("bufio.Write() tmp2, err = ", tmp2, err)
} }
func TestWriteEvent() { func TestWriteDroplet() {
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
e := pb.CreateSampleDroplet() e := pb.CreateSampleDroplet()

View File

@ -26,7 +26,7 @@ func CreateSampleDroplets(total int) []Droplet {
d := CreateSampleDroplet() d := CreateSampleDroplet()
// e.Id += 1000 + int32(i) // e.Id += 1000 + int32(i)
d.Comment = "Sample Event " + string(i) d.Comment = "Sample Droplet " + string(i)
all = append(all, *d) all = append(all, *d)
} }