Configure complex patterns using JSON or YAML
masterWhile simple regular expressions work for literal matches, you can provide more complex patterns by passing a JSON or YAML string. This allows you to attach custom error messages to matches.
The pattern object contains:
msg: An additional comment added to the error message when a match occurs.p: The regular expression to match against the source code (or the expanded expression ifanalyze_typesis enabled).pkg: A regular expression for the full package import path (only supported whenanalyze_typesis enabled).
To distinguish these from standard regex patterns, the string must start with { or contain line breaks.
Examples
JSON format:
{p: "^fmt\\.Println$", msg: "do not write to stdout"}YAML format:
p: ^fmt\.Println$
msg: do not write to stdoutInline JSON-like format:
{p: ^fmt\.Println$, msg: do not write to stdout}