Buffer over-read / trailing garbage in module not found error message
When returning a module not found error using fmt.Errorf("module not found: %s", moduleName), trailing garbage is appended to the error message.
TypeError: module load failed: module not found: testmod.js(?:{unicode}|\\\\[ -~--𐀀-])
TypeError: module load failed: module not found: testmod.js(?:\"(?:{stringchar}|')*\"|'(?:{stringchar}|\")*')
TypeError: module load failed: module not found: testmod.js\u0001
TypeError: module load failed: module not found: testmod.jsecorator\"/></bygroups></rule>\n <rule pattern=\"[()\\[\\],.]\"><token type=\"Punctuation\"/></rule>\n <rule pattern=\"(as|base|break|case|catch|construct|continue|default|delete|do|else|enum|finally|for|for- Fails:
fmt.Errorf("module not found: %s", moduleName)(appends garbage data tomoduleName). - Works:
fmt.Errorf("module not found: %q", moduleName) - Works:
fmt.Errorf("module not found: %s.", moduleName)
This happens with and without my custom normalize function.