You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the readme file the example of sending the event as a cloudevent is wrong as it cannot initialize 1 variables with 2 values. It is missing the reference to err.
Current:
ce:=cdevents.AsCloudEvent(event)
Should be:
ce, err:=cdevents.AsCloudEvent(event)
as per pkg/api/bindings.go line 153
// AsCloudEvent renders a CDEvent as a CloudEventfuncAsCloudEvent(eventCDEventReader) (*cloudevents.Event, error) {
ifevent==nil {
returnnil, fmt.Errorf("nil CDEvent cannot be rendered as CloudEvent")
}
// Validate the eventerr:=Validate(event)
iferr!=nil {
returnnil, fmt.Errorf("cannot validate CDEvent %v", err)
}
ce:=cloudevents.NewEvent()
ce.SetSource(event.GetSource())
ce.SetSubject(event.GetSubjectId())
ce.SetType(event.GetType().String())
err=ce.SetData(cloudevents.ApplicationJSON, event)
return&ce, err
}
The text was updated successfully, but these errors were encountered:
bradmccoydev
changed the title
chore: Update error in example in the README.md for cdevents.AsCloudEvent(event)
Update error in example in the README.md for cdevents.AsCloudEvent(event)
Nov 3, 2022
In the readme file the example of sending the event as a cloudevent is wrong as it cannot initialize 1 variables with 2 values. It is missing the reference to err.
Current:
Should be:
as per pkg/api/bindings.go line 153
The text was updated successfully, but these errors were encountered: