pretty.Diff turned out to not be super helpful when dealing with slices of Members. Using a custom formatter and then doing the diff gave:
[LOG] 0:18.786 DEBUG juju.replicaset Add() changing replica set
from {
Name: juju,
Version: 1,
Members: {
{1 "localhost:43465" foo:bar voting},
},
}
to {
Name: juju,
Version: 2,
Members: {
{1 "localhost:43465" foo:bar voting},
{2 "localhost:41232" voting},
{3 "localhost:36076" voting},
},
}
diff:
Version: 1 != 2
Members: []replicaset.Member[1] != []replicaset.Member[3]
So it didn't really clarify that #2 and #3 were being added.
However, we can at least update the existing "fmtConfigForLog" to do a better job with indenting, etc, and making it much clearer to read.
pretty.Diff turned out to not be super helpful when dealing with slices of Members. Using a custom formatter and then doing the diff gave: Member[ 1] != []replicaset. Member[ 3]
[LOG] 0:18.786 DEBUG juju.replicaset Add() changing replica set
from {
Name: juju,
Version: 1,
Members: {
{1 "localhost:43465" foo:bar voting},
},
}
to {
Name: juju,
Version: 2,
Members: {
{1 "localhost:43465" foo:bar voting},
{2 "localhost:41232" voting},
{3 "localhost:36076" voting},
},
}
diff:
Version: 1 != 2
Members: []replicaset.
So it didn't really clarify that #2 and #3 were being added.
However, we can at least update the existing "fmtConfigForLog" to do a better job with indenting, etc, and making it much clearer to read.
https:/ /github. com/juju/ replicaset/ pull/8