fix: correct fn signatures in Go Events template (#246)

* fix: correct fn signatures in Go Events template
* change cloudevents import name to event

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
This commit is contained in:
Zbynek Roubalik 2020-12-10 22:11:12 +01:00 committed by GitHub
parent 99bee20639
commit 55024921c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 14 deletions

View File

@ -5,24 +5,24 @@ import (
"fmt"
"os"
cloudevents "github.com/cloudevents/sdk-go/v2"
event "github.com/cloudevents/sdk-go/v2"
)
// Handle a CloudEvent.
// Supported Function signatures:
// func()
// func() error
// func(context.Context)
// func(context.Context) error
// func(cloudevents.Event)
// func(cloudevents.Event) error
// func(context.Context, cloudevents.Event)
// func(context.Context, cloudevents.Event) error
// func(cloudevents.Event, *cloudevents.EventResponse)
// func(cloudevents.Event, *cloudevents.EventResponse) error
// func(context.Context, cloudevents.Event, *cloudevents.EventResponse)
// func(context.Context, cloudevents.Event, *cloudevents.EventResponse) error
func Handle(ctx context.Context, event cloudevents.Event) error {
// * func()
// * func() error
// * func(context.Context)
// * func(context.Context) error
// * func(event.Event)
// * func(event.Event) error
// * func(context.Context, event.Event)
// * func(context.Context, event.Event) error
// * func(event.Event) *event.Event
// * func(event.Event) (*event.Event, error)
// * func(context.Context, event.Event) *event.Event
// * func(context.Context, event.Event) (*event.Event, error)
func Handle(ctx context.Context, event event.Event) error {
if err := event.Validate(); err != nil {
fmt.Fprintf(os.Stderr, "invalid event received. %v", err)
return err