Distributed Services with Go agent test


When writing agent_test.go in page 134, the package name is agent_test when other tests use the same package name. For example log_test.go uses log package name instead of log_test.

Why not make the agent test package name agent so that naming is consistent with other tests? Also this negates the need of adding agent namespace when we want to use Agent struct.

package agent_test
var agents []*agent.Agent
agent, err := agent.New(agent.Config{


package agent
var agents []*Agent
agent, err := New(Config{

Also the variable agent is no longer collides with the imported package agent because we do not need to import this → "github.com/travisjeffery/proglog/internal/agent") anymore.

This is done for black-box testing. When it is a different package agent_test.go vs agent package is different you will have access to only the public methods.