Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active August 6, 2021 11:37
Show Gist options
  • Save percybolmer/3cc03a9ff2fe4c76295092c897e07421 to your computer and use it in GitHub Desktop.
Save percybolmer/3cc03a9ff2fe4c76295092c897e07421 to your computer and use it in GitHub Desktop.
// NewNetworkPayload is used to convert a regular payload into a network payload
func NewNetworkPayload(pay Payload) (*NetworkPayload, error) {
conv, ok := pay.(*NetworkPayload)
if ok {
return conv, nil
}
return nil, ErrPayloadIsNotANetworkPayload
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment