main
Raw Download raw file
 1Update the functional options to not use with closures (the Uber Style Guide says so).
 2
 3Here is an example function:
 4
 5```go
 6// Option interface enables functional options on CF
 7type Option interface {
 8	apply(*CF) error
 9}
10
11func ZoneName(name string) Option {
12	return zoneNameOption(name)
13}
14
15type zoneNameOption string
16
17func (zn zoneNameOption) apply(cf *CF) error {
18	name := string(zn)
19	id, err := cf.api.ZoneIDByName(name)
20	if err != nil {
21		return fmt.Errorf("failed to lookup zone id name=%s: %w", name, err)
22	}
23	cf.zoneID = id
24	return nil
25}
26```