Skip to content

Instantly share code, notes, and snippets.

@codegold79
Last active October 2, 2020 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codegold79/8528d1e15fb6f58c3930dc636efbbde5 to your computer and use it in GitHub Desktop.
Save codegold79/8528d1e15fb6f58c3930dc636efbbde5 to your computer and use it in GitHub Desktop.
func parseCloudEvent(req []byte) (cloudEvent, error) {
var event cloudEvent
err := json.Unmarshal(req, &event)
if err != nil {
return cloudEvent{}, fmt.Errorf("unmarshalling json: %w", err)
}
if err := isValidEvent(event); err != nil {
return cloudEvent{}, err
}
return event, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment