From d74e1affeed4972e20e4ea23d9509b3eeaa9786a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 4 May 2023 13:08:48 +0200 Subject: [PATCH] fix: use text/template instead --- modulegen/main.go | 5 +++-- modulegen/main_test.go | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modulegen/main.go b/modulegen/main.go index 07ec2a0fbe..b9788dbc92 100644 --- a/modulegen/main.go +++ b/modulegen/main.go @@ -3,13 +3,14 @@ package main import ( "flag" "fmt" - "html/template" + htmltemplate "html/template" "os" "os/exec" "path/filepath" "regexp" "sort" "strings" + "text/template" "unicode" "unicode/utf8" @@ -182,7 +183,7 @@ func generate(example Example, rootDir string) error { "ParentDir": func() string { return example.ParentDir() }, "ToLower": func() string { return example.Lower() }, "Title": func() string { return example.Title() }, - "codeinclude": func(s string) template.HTML { return template.HTML(s) }, // escape HTML comments for codeinclude + "codeinclude": func(s string) htmltemplate.HTML { return htmltemplate.HTML(s) }, // escape HTML comments for codeinclude } // create the example dir diff --git a/modulegen/main_test.go b/modulegen/main_test.go index 0d417a9792..0a616d650b 100644 --- a/modulegen/main_test.go +++ b/modulegen/main_test.go @@ -472,6 +472,7 @@ func assertExampleGithubWorkflowContent(t *testing.T, example Example, exampleWo data := strings.Split(sanitiseContent(string(content)), "\n") assert.Equal(t, "name: "+title+" "+example.Type()+" pipeline", data[0]) assert.Equal(t, " test-"+lower+":", data[23]) + assert.Equal(t, " if: ${{ github.event.workflow_run.conclusion == 'success' }}", data[24]) assert.Equal(t, " go-version: ${{ matrix.go-version }}", data[34]) assert.Equal(t, " working-directory: ./"+example.ParentDir()+"/"+lower, data[41]) assert.Equal(t, " working-directory: ./"+example.ParentDir()+"/"+lower, data[45])