WithLocation adds a location to an existing finding. No copy is made.
(loc *Location)
| 204 | // WithLocation adds a location to an existing finding. |
| 205 | // No copy is made. |
| 206 | func (f *Finding) WithLocation(loc *Location) *Finding { |
| 207 | f.Location = loc |
| 208 | if f.Remediation != nil && f.Location != nil { |
| 209 | // Replace location data. |
| 210 | f.Remediation.Text = strings.ReplaceAll(f.Remediation.Text, |
| 211 | "${{ finding.location.path }}", f.Location.Path) |
| 212 | f.Remediation.Markdown = strings.ReplaceAll(f.Remediation.Markdown, |
| 213 | "${{ finding.location.path }}", f.Location.Path) |
| 214 | } |
| 215 | return f |
| 216 | } |
| 217 | |
| 218 | // WithValues sets the values to an existing finding. |
| 219 | // No copy is made. |
no outgoing calls