Distributed Services with Go: Need to add GetServerer: a.log to setupServer() (pg. 184)

Test Discovery and Balancing End-to-End

Reader is instructed to Run your tests again and watch them pass. However, the reader will encounter a nil pointer error.

Although mentioned in the book, it never really clearly requests the update…they still need to add the log to GetServerer in the agent’s setupServer or else it will encounter a nil pointer.

agent.go

func (a *Agent) setupServer() error {
	authorizer := auth.New(
		a.Config.ACLModelFile,
		a.Config.ACLPolicyFile,
	)
	serverConfig := &server.Config{
		CommitLog:   a.log,
		Authorizer:  authorizer,
		GetServerer: a.log, // <--- add this
	}
...