import ( "github.com/cloudfoundry/sonde-go/events" ) ... // create a new envelope envelope := &events.Envelope{} // set the envelope type to "CounterEvent" envelope.EventType = events.Envelope_CounterEvent.Enum() // create a new counter event counterEvent := &events.CounterEvent{ Name: proto.String("my-counter"), Delta: proto.Uint64(1), } // set the counter event in the envelope envelope.CounterEvent = counterEvent // get the counter event from the envelope event := envelope.GetCounterEvent() // print the name and delta fmt.Println("Name:", event.GetName()) fmt.Println("Delta:", event.GetDelta())This code creates a new envelope, sets the envelope type to CounterEvent, creates a new CounterEvent, sets the CounterEvent in the envelope, retrieves the CounterEvent using GetCounterEvent, and then prints the name and delta of the CounterEvent.