From 2da4e4c31db74e8d65d4fc5d1cf829f5fc55d6b6 Mon Sep 17 00:00:00 2001 From: Atsushi Ishibashi Date: Mon, 16 Oct 2017 11:45:18 +0900 Subject: [PATCH] Change func name --- builder/googlecompute/templace_funcs.go | 4 ++-- builder/googlecompute/templace_funcs_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/builder/googlecompute/templace_funcs.go b/builder/googlecompute/templace_funcs.go index cb1b6d4bf..0831cf410 100644 --- a/builder/googlecompute/templace_funcs.go +++ b/builder/googlecompute/templace_funcs.go @@ -18,7 +18,7 @@ func isalphanumeric(b byte) bool { // Clean up image name by replacing invalid characters with "-" // truncate up to 63 length, convert to a lower case -func templateCleanAMIName(s string) string { +func templateCleanImageName(s string) string { re := regexp.MustCompile(`^[a-z][-a-z0-9]{0,61}[a-z0-9]$`) if re.MatchString(s) { return s @@ -40,5 +40,5 @@ func templateCleanAMIName(s string) string { } var TemplateFuncs = template.FuncMap{ - "clean_ami_name": templateCleanAMIName, + "clean_image_name": templateCleanImageName, } diff --git a/builder/googlecompute/templace_funcs_test.go b/builder/googlecompute/templace_funcs_test.go index 36a4b475b..b943ab911 100644 --- a/builder/googlecompute/templace_funcs_test.go +++ b/builder/googlecompute/templace_funcs_test.go @@ -2,7 +2,7 @@ package googlecompute import "testing" -func Test_templateCleanAMIName(t *testing.T) { +func Test_templateCleanImageName(t *testing.T) { vals := []struct { origName string expected string @@ -26,7 +26,7 @@ func Test_templateCleanAMIName(t *testing.T) { } for _, v := range vals { - name := templateCleanAMIName(v.origName) + name := templateCleanImageName(v.origName) if name != v.expected { t.Fatalf("template names do not match: expected %s got %s\n", v.expected, name) }