@@ -17,29 +17,29 @@ type Container struct {
1717type Containers map [string ]Container
1818
1919// Add a container to the list of monitored containers.
20- func (c * Containers ) Add (id string , new Container ) {
20+ func (c * Containers ) Add (containerID string , newContainer Container ) {
2121 // Is container already in containers?
22- existing , ok := (* c )[id ]
22+ existing , ok := (* c )[containerID ]
2323
2424 if ! ok {
25- (* c )[id ] = new
25+ (* c )[containerID ] = newContainer
2626
2727 return
2828 }
2929
3030 // This is an old state (we know a newer state). Ignore and
3131 // return.
32- if existing .Changed .After (new .Changed ) {
32+ if existing .Changed .After (newContainer .Changed ) {
3333 return
3434 }
3535
3636 // Remember the new state.
37- (* c )[id ] = new
37+ (* c )[containerID ] = newContainer
3838}
3939
4040// Healthy if all containers are healthy.
41- func (c Containers ) Healthy () bool {
42- for _ , container := range c {
41+ func (c * Containers ) Healthy () bool {
42+ for _ , container := range * c {
4343 if container .Status != types .Healthy && container .Status != types .NoHealthcheck {
4444 return false
4545 }
@@ -49,12 +49,12 @@ func (c Containers) Healthy() bool {
4949}
5050
5151// Unhealthy if one of the containers get unhealthy.
52- func (c Containers ) Unhealthy () error {
53- for _ , container := range c {
52+ func (c * Containers ) Unhealthy () error {
53+ for _ , container := range * c {
5454 if container .Status == types .Unhealthy {
5555 return fmt .Errorf (
5656 "%w: %s" ,
57- unhealthyError ,
57+ errUnhealthy ,
5858 strings .Join (c .UnhealtyContainers (), ", " ),
5959 )
6060 }
@@ -64,10 +64,10 @@ func (c Containers) Unhealthy() error {
6464}
6565
6666// NonHealtyContainers returns a list of container names of containers that are not healthy (yet).
67- func (c Containers ) NonHealtyContainers () []string {
67+ func (c * Containers ) NonHealtyContainers () []string {
6868 var nonHealthy []string
6969
70- for _ , container := range c {
70+ for _ , container := range * c {
7171 if container .Status != types .Healthy && container .Status != types .NoHealthcheck {
7272 nonHealthy = append (nonHealthy , container .Name )
7373 }
@@ -77,10 +77,10 @@ func (c Containers) NonHealtyContainers() []string {
7777}
7878
7979// UnhealtyContainers returns a list of container names of containers that are not healthy (yet).
80- func (c Containers ) UnhealtyContainers () []string {
80+ func (c * Containers ) UnhealtyContainers () []string {
8181 var unhealthy []string
8282
83- for _ , container := range c {
83+ for _ , container := range * c {
8484 if container .Status == types .Unhealthy {
8585 unhealthy = append (unhealthy , container .Name )
8686 }
0 commit comments