teivah / 100-go-mistakes

📖 100 Go Mistakes and How to Avoid Them

Home Page:https://100go.co/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mistake #11 - Builder pattern part

ndjordjevic opened this issue · comments

Func NewServer is defined as:
func NewServer(addr string, config Config) (*http.Server, error)
... you can't pass nil as a config param right?
You said this:

However, we still need to pass a
config struct that can be empty if a client wants to use the default configuration:
server, err := httplib.NewServer("localhost", nil)

Thanks, it'll be fixed in the next version 🙏