|
|
@ -92,6 +92,9 @@ func (m *Map) PrettyDiffFrom(old *Map) string {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
buf := new(strings.Builder)
|
|
|
|
buf := new(strings.Builder)
|
|
|
|
|
|
|
|
space := func() bool {
|
|
|
|
|
|
|
|
return buf.Len() < (1 << 10)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for len(oldNames) > 0 && len(newNames) > 0 {
|
|
|
|
for len(oldNames) > 0 && len(newNames) > 0 {
|
|
|
|
var name string
|
|
|
|
var name string
|
|
|
@ -109,6 +112,9 @@ func (m *Map) PrettyDiffFrom(old *Map) string {
|
|
|
|
oldNames = oldNames[1:]
|
|
|
|
oldNames = oldNames[1:]
|
|
|
|
newNames = newNames[1:]
|
|
|
|
newNames = newNames[1:]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !space() {
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ipOld, inOld := oldNameToIP[name]
|
|
|
|
ipOld, inOld := oldNameToIP[name]
|
|
|
|
ipNew, inNew := newNameToIP[name]
|
|
|
|
ipNew, inNew := newNameToIP[name]
|
|
|
@ -128,6 +134,9 @@ func (m *Map) PrettyDiffFrom(old *Map) string {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for _, name := range oldNames {
|
|
|
|
for _, name := range oldNames {
|
|
|
|
|
|
|
|
if !space() {
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
}
|
|
|
|
if _, ok := newNameToIP[name]; !ok {
|
|
|
|
if _, ok := newNameToIP[name]; !ok {
|
|
|
|
buf.WriteByte('-')
|
|
|
|
buf.WriteByte('-')
|
|
|
|
printSingleNameIP(buf, name, oldNameToIP[name])
|
|
|
|
printSingleNameIP(buf, name, oldNameToIP[name])
|
|
|
@ -135,11 +144,17 @@ func (m *Map) PrettyDiffFrom(old *Map) string {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for _, name := range newNames {
|
|
|
|
for _, name := range newNames {
|
|
|
|
|
|
|
|
if !space() {
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
}
|
|
|
|
if _, ok := oldNameToIP[name]; !ok {
|
|
|
|
if _, ok := oldNameToIP[name]; !ok {
|
|
|
|
buf.WriteByte('+')
|
|
|
|
buf.WriteByte('+')
|
|
|
|
printSingleNameIP(buf, name, newNameToIP[name])
|
|
|
|
printSingleNameIP(buf, name, newNameToIP[name])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !space() {
|
|
|
|
|
|
|
|
buf.WriteString("... [truncated]\n")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return buf.String()
|
|
|
|
return buf.String()
|
|
|
|
}
|
|
|
|
}
|
|
|
|