Intermediate
Go (Golang)
Q79 / 100
What is a functional option pattern in Go?
Correct! Well done.
Incorrect.
The correct answer is B) Passing variadic func(T) functions to constructors, allowing flexible and extensible configuration without large config structs
B
Correct Answer
Passing variadic func(T) functions to constructors, allowing flexible and extensible configuration without large config structs
Explanation
func NewServer(opts ...Option) — Option is func(*Server). WithTimeout(d) returns func(*Server) { s.timeout = d }. Popular in Go libraries like grpc-go.
Progress
79/100