Skip to content

Commit

Permalink
fixing linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sethiyash committed Nov 24, 2022
1 parent eb32921 commit e615314
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
6 changes: 3 additions & 3 deletions pkg/kapp/resources/mod_field_copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ func (t FieldCopyMod) apply(obj interface{}, path Path, fullPath Path, srcs map[
return false, fmt.Errorf("Unexpected non-map found: %T", obj)
}
var anyUpdated bool
for key, _ := range typedObj {
for key, obj := range typedObj {
if regex.MatchString(key) {
keyPointer := key
path[len(path)-1] = &PathPart{MapKey: &keyPointer}

updated, err := t.apply(obj, path[i:], fullPath[:len(fullPath)-1], srcs)
newFullPath := fullPath[:len(fullPath)-1]
updated, err := t.apply(obj, path[i:], newFullPath, srcs)
if err != nil {
return false, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kapp/resources/mod_field_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ func (t FieldRemoveMod) apply(obj interface{}, path Path) error {
}

panic("unreachable")
}
}
9 changes: 0 additions & 9 deletions pkg/kapp/resources/mod_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ func (p *PathPart) AsString() string {
return "(all)"
case p.IndexAndRegex != nil && p.IndexAndRegex.Regex != nil:
return *p.IndexAndRegex.Regex
//case p.RegexPath != nil && p.RegexPath.Regex != nil:
// return *p.RegexPath.Regex
default:
panic("Unknown path part")
}
Expand All @@ -116,19 +114,12 @@ func (p *PathPart) AsString() string {
func (p *PathPart) UnmarshalJSON(data []byte) error {
var str string
var idx PathPartIndexAndRegex
//var regx PathPartRegex

switch {
case json.Unmarshal(data, &str) == nil:
//if strings.Contains(str, "regex") {
// fmt.Println(str)
//}
p.MapKey = &str
case json.Unmarshal(data, &idx) == nil:
p.IndexAndRegex = &idx
//case json.Unmarshal(data, &regx) == nil:
// fmt.Println(regx)
// p.RegexPath = &regx
default:
return fmt.Errorf("Unknown path part")
}
Expand Down

0 comments on commit e615314

Please sign in to comment.