Diff returns the difference between the textual representation of two deployments
(other *Deployment)
| 176 | |
| 177 | // Diff returns the difference between the textual representation of two deployments |
| 178 | func (d *Deployment) Diff(other *Deployment) string { |
| 179 | if other == nil { |
| 180 | return "other was nil" |
| 181 | } |
| 182 | diff := difflib.UnifiedDiff{ |
| 183 | A: difflib.SplitLines(d.String()), |
| 184 | B: difflib.SplitLines(other.String()), |
| 185 | FromFile: "ThisDeployment", |
| 186 | ToFile: "OtherDeployment", |
| 187 | } |
| 188 | |
| 189 | out, err := difflib.GetUnifiedDiffString(diff) |
| 190 | if err != nil { |
| 191 | panic(err) |
| 192 | } |
| 193 | |
| 194 | return out |
| 195 | } |
| 196 | |
| 197 | // PathDiff returns the list of the paths of objects. |
| 198 | // Currently doesn't detect modifications |