(tmplStr string, variables *GeneratorOptions)
| 155 | } |
| 156 | |
| 157 | func interpolateDescription(tmplStr string, variables *GeneratorOptions) (string, error) { |
| 158 | tmpl, err := template.New("description").Parse(tmplStr) |
| 159 | if err != nil { |
| 160 | return "", fmt.Errorf("failed to parse description template: %w", err) |
| 161 | } |
| 162 | |
| 163 | description := new(bytes.Buffer) |
| 164 | if err = tmpl.Execute(description, &DescriptionVariables{ |
| 165 | ActorType: variables.ActorType, |
| 166 | ActorID: variables.ActorID, |
| 167 | ActorName: variables.ActorName, |
| 168 | ActorEmail: variables.ActorEmail, |
| 169 | OrgID: variables.OrgID, |
| 170 | }); err != nil { |
| 171 | return "", fmt.Errorf("failed to execute description template: %w", err) |
| 172 | } |
| 173 | |
| 174 | return description.String(), nil |
| 175 | } |
| 176 | |
| 177 | type GeneratorOption func(*GeneratorOptions) error |
| 178 | type GeneratorOptions struct { |
no test coverage detected