Tags: #go #golang #struct #options #arguments #parameters #function #signature
Instead of a long list of function arguments, consider using a struct.
Because types are initialized with a zero value, it means we can easily omit a field if we want.
type FooOptions struct {
beep string
boop string
bing int
}
f, err := foo(FooOptions{
beep: "hello",
bing: 123,
})
// notice `boop` field was omitted.