diff --git a/example-protobuf/main.go b/example-protobuf/main.go index 1705e70..bf40cc6 100644 --- a/example-protobuf/main.go +++ b/example-protobuf/main.go @@ -40,8 +40,6 @@ func marshalWriteToFile(myWriter *bufio.Writer, e *pb.Event) { myWriter.Flush() log.Println("bufio.Write() tmp, err = ", tmp, err) - e.Id += 1 - e.Name = "jcarrEvent21" buf, err = proto.Marshal(e) tmp2, err := myWriter.Write(buf) myWriter.Flush() @@ -52,8 +50,6 @@ func TestWriteEvent() { buf := new(bytes.Buffer) e := pb.CreateSampleEvent() - e.Id += 1 - e.Name = "jcarrEvent2" got := buf.String() log.Println(got) diff --git a/sampleData.go b/sampleData.go index 19281ac..5d41496 100644 --- a/sampleData.go +++ b/sampleData.go @@ -1,28 +1,27 @@ package witProtobuf import "log" -// import "bytes" -// import "os" -// import "bufio" -// import "io" -// import "io/ioutil" + +// +// This generates some sample data. It *should* match the .proto file +// func CreateSampleEvent() *Event { // TODO: flush this out to do all the fields log.Println("CreateSampleEvent() is generating a example protobuf Event") e := &Event{ - Id: 1234, - Name: "jcarrEvent1", - Email: "jcarr@wit.com", - Results: []*Event_Response{ - {Name: "foobar", Type: Event_ADD}, + Id: 1234, + Name: "Somekind of Event1", + Email: "test+protobuf@wit.com", + Comment: "this is a sample event", + Results: []*Event_Response{ + {Name: "fooadd", Type: Event_ADD}, + {Name: "foodelete", Type: Event_DELETE}, + {Name: "foopoweron", Type: Event_POWERON}, }, } - e.Id += 1 - e.Name = "jcarrEvent2" - return e } @@ -36,7 +35,7 @@ func CreateSampleEvents(total int) []Event { e := CreateSampleEvent() e.Id += 1000 + int32(i) - e.Name = "jcarrEvent2" + e.Name = "Sample Event " + string(i) all = append(all, *e) }