Open
Description
Setters are not heavily used in Go, so we should revisit a more idiomatic approach either by setting things on the struct directly or using functions options which is pretty standard in Go
So instead of
event := cdevents.NewSomeCDEvent()
event.SetFoo("foo")
we'd have something more like
event := cdevents.NewSomeCDEvent(cdevent.SomeCDEventOptions.WithFields(func(e cdevents.SomeCDEvent) {
e.Foo = "foo"
})
// or
event := cdevents.NewSomeCDEvent(cdevent.SomeCDEventOptions.WithFoo("foo"))
Or a combination of the two. So is one better than the other? Not necessarily. But one is more idiomatic, and that's crucial for SDKs.
Metadata
Metadata
Assignees
Labels
No labels