Merge pull request #77 from uthark/golint

Fix go lint error and add golint checks to a pre-commit hook
This commit is contained in:
Jeff Regan
2018-06-10 10:35:56 -07:00
committed by GitHub
18 changed files with 58 additions and 24 deletions

View File

@@ -66,11 +66,13 @@ func (r *Resource) Id() ResId {
return NewResId(r.GroupVersionKind(), r.GetName())
}
// Merge performs merge with other resource.
func (r *Resource) Merge(other *Resource) {
r.Replace(other)
mergeConfigmap(r.Object, other.Object, r.Object)
}
// Replace performs replace with other resource.
func (r *Resource) Replace(other *Resource) {
r.SetLabels(mergeStringMaps(other.GetLabels(), r.GetLabels()))
r.SetAnnotations(mergeStringMaps(other.GetAnnotations(), r.GetAnnotations()))
@@ -101,6 +103,7 @@ func mergeStringMaps(maps ...map[string]string) map[string]string {
return result
}
// GetFieldValue returns value at the given fieldpath.
func (r *Resource) GetFieldValue(fieldPath string) (string, error) {
return getFieldValue(r.UnstructuredContent(), strings.Split(fieldPath, "."))
}