diff: Fix overlapping filenames

The filename can overlap when multiple resources have the same name (but
obviously are of a different type). Include the name of the type in the
file name to prevent the overlap.
This commit is contained in:
Antoine Pelisse
2018-12-10 15:46:03 -08:00
parent 0914272a42
commit b6135f63aa
7 changed files with 62 additions and 1 deletions

View File

@@ -289,7 +289,17 @@ func (obj InfoObject) Merged() (runtime.Object, error) {
}
func (obj InfoObject) Name() string {
return obj.Info.Name
group := ""
if obj.Info.Mapping.GroupVersionKind.Group != "" {
group = fmt.Sprintf("%v.", obj.Info.Mapping.GroupVersionKind.Group)
}
return group + fmt.Sprintf(
"%v.%v:%v.%v",
obj.Info.Mapping.GroupVersionKind.Version,
obj.Info.Mapping.GroupVersionKind.Kind,
obj.Info.Namespace,
obj.Info.Name,
)
}
// Differ creates two DiffVersion and diffs them.