From e9b4b9b34d3edcc89465b500615b67840b251112 Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Tue, 30 May 2023 18:02:24 -0400 Subject: [PATCH] CHORE: Rename js.Javascript to js.JavaScript (#2405) --- commands/printIR.go | 2 +- pkg/js/js.go | 4 ++-- pkg/js/js_test.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/commands/printIR.go b/commands/printIR.go index 1241c0317..82dc48efd 100644 --- a/commands/printIR.go +++ b/commands/printIR.go @@ -122,7 +122,7 @@ func ExecuteDSL(args ExecuteDSLArgs) (*models.DNSConfig, error) { return nil, fmt.Errorf("no config specified") } - dnsConfig, err := js.ExecuteJavascript(args.JSFile, args.DevMode, stringSliceToMap(args.Variable)) + dnsConfig, err := js.ExecuteJavaScript(args.JSFile, args.DevMode, stringSliceToMap(args.Variable)) if err != nil { return nil, fmt.Errorf("executing %s: %w", args.JSFile, err) } diff --git a/pkg/js/js.go b/pkg/js/js.go index 8a45dace0..c2e5f49ab 100644 --- a/pkg/js/js.go +++ b/pkg/js/js.go @@ -35,8 +35,8 @@ var currentDirectory string // EnableFetch sets whether to enable fetch() in JS execution environment var EnableFetch bool = false -// ExecuteJavascript accepts a javascript file and runs it, returning the resulting dnsConfig. -func ExecuteJavascript(file string, devMode bool, variables map[string]string) (*models.DNSConfig, error) { +// ExecuteJavaScript accepts a javascript file and runs it, returning the resulting dnsConfig. +func ExecuteJavaScript(file string, devMode bool, variables map[string]string) (*models.DNSConfig, error) { script, err := os.ReadFile(file) if err != nil { return nil, err diff --git a/pkg/js/js_test.go b/pkg/js/js_test.go index b45268470..9b1ef438a 100644 --- a/pkg/js/js_test.go +++ b/pkg/js/js_test.go @@ -41,7 +41,7 @@ func TestParsedFiles(t *testing.T) { var err error // Compile the .js file: - conf, err := ExecuteJavascript(string(filepath.Join(testDir, name)), true, nil) + conf, err := ExecuteJavaScript(string(filepath.Join(testDir, name)), true, nil) if err != nil { t.Fatal(err) } @@ -144,7 +144,7 @@ func TestErrors(t *testing.T) { } for _, tst := range tests { t.Run(tst.desc, func(t *testing.T) { - if _, err := ExecuteJavascript(tst.text, true, nil); err == nil { + if _, err := ExecuteJavaScript(tst.text, true, nil); err == nil { t.Fatal("Expected error but found none") } })