From f6010731ce5265f8800036a28239274cf4392ff9 Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Sat, 5 Aug 2023 16:31:53 -0400 Subject: [PATCH] Change quoting in error message (use %q) --- amod/amod.go | 4 ++-- amod/amod_config_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/amod/amod.go b/amod/amod.go index 3c512fe..0aafea9 100644 --- a/amod/amod.go +++ b/amod/amod.go @@ -276,11 +276,11 @@ func setModuleParams(module modules.Interface, log *issueLog, fields []*field) { case errors.As(err, &keyvalue.ErrInvalidType{}) || errors.As(err, &modules.ErrInvalidValue{}) || errors.As(err, &modules.ErrValueOutOfRange{}): - log.errorTR(value.Tokens, 1, 1, "%s '%s' %v", moduleName, field.Key, err) + log.errorTR(value.Tokens, 1, 1, "%s %q %v", moduleName, field.Key, err) continue default: - log.errorT(field.Tokens, "INTERNAL: unhandled error (%v) in %s config: '%s'", err, moduleName, field.Key) + log.errorT(field.Tokens, "INTERNAL: unhandled error (%v) in %s config: %q", err, moduleName, field.Key) continue } } diff --git a/amod/amod_config_test.go b/amod/amod_config_test.go index 08e0b63..6450b14 100644 --- a/amod/amod_config_test.go +++ b/amod/amod_config_test.go @@ -248,7 +248,7 @@ func Example_imaginalFieldType() { ~~ productions ~~`) // Output: - // ERROR: imaginal 'delay' must be a number (line 6, col 20) + // ERROR: imaginal "delay" must be a number (line 6, col 20) } func Example_imaginalFieldRange() { @@ -263,7 +263,7 @@ func Example_imaginalFieldRange() { ~~ productions ~~`) // Output: - // ERROR: imaginal 'delay' is out of range (minimum 0) (line 6, col 20) + // ERROR: imaginal "delay" is out of range (minimum 0) (line 6, col 20) } func Example_imaginalFieldUnrecognized() { @@ -308,7 +308,7 @@ func Example_memoryDecayOutOfRange() { ~~ productions ~~`) // Output: - // ERROR: memory 'decay' is out of range (0-1) (line 6, col 18) + // ERROR: memory "decay" is out of range (0-1) (line 6, col 18) } func Example_memoryDecayOutOfRange2() { @@ -323,7 +323,7 @@ func Example_memoryDecayOutOfRange2() { ~~ productions ~~`) // Output: - // ERROR: memory 'decay' is out of range (0-1) (line 6, col 18) + // ERROR: memory "decay" is out of range (0-1) (line 6, col 18) } func Example_proceduralFieldUnrecognized() {