// NewServices now will accept a list of config functions to
// run. Each function will accept a pointer to the current
// Services object as its only argument and will edit that
// object inline and return an error if there is one. Once
// we have run all configs we will return the Services object.
NewServices now will accept a list of config functions to
run. Each function will accept a pointer to the current
Services object as its only argument and will edit that
object inline and return an error if there is one. Once
we have run all configs we will return the Services object.
// NewServices now will accept a list of config functions to // run . Each function will accept a pointer to the current // Services object as its only argument and will edit that // object inline and return an error if there is one . Once // we have run all configs we will return the Services object .
func NewServices(cfgs ...ServicesConfig) (*Services, error) {
	var s Services
	for _, cfg := range cfgs {
		if err := cfg(&s); err != nil {
			return nil, err
		}
	}
	return &s, nil
}
func NewServices ( cfgs ... ServicesConfig ) ( * Services , error ) { var s Services for _ , cfg := range cfgs { if err := cfg ( & s ) ; err != nil { return nil , err } } return & s , nil }
NewServices now will accept a list of config functions to
run.
NewServices now will accept a list of config functions to run .
// For each ServicesConfig function... // Run the function passing in a pointer to our Services // object and catching any errors // Then finally return the result