Skip to content

Commit

Permalink
fix: if marker uses replace argument set original value to replace va…
Browse files Browse the repository at this point in the history
…lue (#283)

* fix: if marker uses replace argument set original value to replace value

note: this does fix issue completely, still need to resolve if replace text is regex statement
Signed-off-by: Jeff Davis <jeffda@vmware.com>

* chore: fix linter error

Signed-off-by: Dustin Scott <sdustin@vmware.com>

Co-authored-by: Dustin Scott <sdustin@vmware.com>
  • Loading branch information
JefeDavis and Dustin Scott authored Apr 9, 2022
1 parent 10462a4 commit a42d2eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/workload/v1/markers/collection_field_marker.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ func (cfm *CollectionFieldMarker) IsForCollection() bool {
}

func (cfm *CollectionFieldMarker) SetOriginalValue(value string) {
if cfm.GetReplaceText() != "" {
cfm.originalValue = cfm.GetReplaceText()

return
}

cfm.originalValue = &value
}

Expand Down
6 changes: 6 additions & 0 deletions internal/workload/v1/markers/field_marker.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ func (fm *FieldMarker) IsForCollection() bool {
}

func (fm *FieldMarker) SetOriginalValue(value string) {
if fm.GetReplaceText() != "" {
fm.originalValue = fm.GetReplaceText()

return
}

fm.originalValue = &value
}

Expand Down

0 comments on commit a42d2eb

Please sign in to comment.