Minor cleanup and and got the client sending agents again.

This commit is contained in:
James Wells 2022-07-14 13:27:46 -07:00
parent 42623f63c6
commit 134f33cd6a
Signed by: jwells
GPG key ID: 73196D10B8E65666
7 changed files with 50 additions and 64 deletions

View file

@ -28,7 +28,8 @@ func NewConsulClient(addr string) (Client, error) {
if err != nil {
return nil, err
}
return &client{consul: c}, nil
return &client{c}, nil
//return &client{consul: c}, nil
}
// Register a service with consul local agent
@ -51,10 +52,10 @@ func (c *client) Service(service, tag string) ([]*consul.ServiceEntry, *consul.Q
passingOnly := true
addrs, meta, err := c.consul.Health().Service(service, tag, passingOnly, nil)
if len(addrs) == 0 && err == nil {
return nil, fmt.Errorf("service ( %s ) was not found", service)
return nil, nil, fmt.Errorf("service ( %s ) was not found", service)
}
if err != nil {
return nil, err
return nil, nil, err
}
return addrs, meta, nil
}