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
	}
...

Thanks a lot! I just fixed this in the book. It will be there in the final copy.

Thanks for all your reports, by the way.

I ended up going through the entire book, over every snippet to make sure it all worked for the final copy.

1 Like