Skip to content

Commit

Permalink
Rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Mar 18, 2024
1 parent 575d259 commit dbcf2dd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,22 +213,22 @@ func main() {

// parseTemplate parses a template file, with fallback to default.
//
// If `configFileSettingValue` is non-empty, it is used as the name of a file to read. Otherwise, `defaultTemplate` is
// If `templateFilePath` is non-empty, it is used as the name of a file to read. Otherwise, `defaultTemplate` is
// used.
//
// The template text is then parsed into a template named `templateName`.
func parseTemplate(defaultTemplate string, configFileSettingValue string, templateName string) *template.Template {
func parseTemplate(defaultTemplate string, templateFilePath string, templateName string) *template.Template {
templateText := defaultTemplate
if configFileSettingValue != "" {
issueTemplateBytes, err := os.ReadFile(configFileSettingValue)
if templateFilePath != "" {
issueTemplateBytes, err := os.ReadFile(templateFilePath)
if err != nil {
log.Fatalf("Unable to read template file `%s`: %s", configFileSettingValue, err)
log.Fatalf("Unable to read template file `%s`: %s", templateFilePath, err)
}
templateText = string(issueTemplateBytes)
}
parsedTemplate, err := template.New(templateName).Parse(templateText)
if err != nil {
log.Fatalf("Invalid template file %s in config file: %s", configFileSettingValue, err)
log.Fatalf("Invalid template file %s in config file: %s", templateFilePath, err)
}
return parsedTemplate
}
Expand Down

0 comments on commit dbcf2dd

Please sign in to comment.