{"record":{"id":"16ddce7754e8c2c0","repo":"jdx/mise","slug":"unexpected-raw-go-string-delimiter","errorCode":null,"errorMessage":"unexpected raw Go string delimiter","messagePattern":"unexpected raw Go string delimiter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/workspace/go.rs","lineNumber":194,"sourceCode":"    Some(rest.trim())\n}\n\nfn parse_argument(value: &str) -> Result<String> {\n    if value.is_empty() {\n        bail!(\"directive requires one argument\");\n    }\n    if let Some(value) = value.strip_prefix('\"') {\n        let Some(value) = value.strip_suffix('\"') else {\n            bail!(\"unterminated interpreted Go string\");\n        };\n        return unescape_go_string(value);\n    }\n    if let Some(value) = value.strip_prefix('`') {\n        let Some(value) = value.strip_suffix('`') else {\n            bail!(\"unterminated raw Go string\");\n        };\n        if value.contains('`') {\n            bail!(\"unexpected raw Go string delimiter\");\n        }\n        return Ok(value.to_string());\n    }\n    if value.split_whitespace().count() != 1 {\n        bail!(\"directive requires exactly one argument\");\n    }\n    Ok(value.to_string())\n}\n\nfn unescape_go_string(value: &str) -> Result<String> {\n    let mut characters = value.chars();\n    let mut unescaped = String::new();\n    while let Some(character) = characters.next() {\n        if character == '\"' {\n            bail!(\"unexpected interpreted Go string delimiter\");\n        }\n        if character != '\\\\' {\n            unescaped.push(character);","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/task/workspace/go.rs#L176-L212","documentation":"After a raw Go string opens with a backtick and closes, parse_argument rejects a value that still contains another backtick inside, bailing with 'unexpected raw Go string delimiter'. Go raw strings cannot contain backticks, and a stray one would make the argument ambiguous.","triggerScenarios":"A backtick-quoted directive argument in go.work/go.mod contains an inner backtick, e.g. `` use `./a`b` `` — the parser matches the first pair of backticks, finds a leftover one, and fails.","commonSituations":"Copy-pasting paths that include backticks (e.g. from markdown or shell command substitution syntax) into go.work/go.mod; a templating script injecting unescaped backticks.","solutions":["Remove the interior backtick from the path/value.","Use double quotes (interpreted string) with escape sequences instead, or an unquoted plain token.","If the path genuinely needs a backtick, rename the directory — Go tooling cannot represent it in raw strings either."],"exampleFix":"// before (go.work)\nuse `./`weird`dir`\n\n// after\nuse \"./`weird`dir\" // rename instead: use ./weird-dir","handlingStrategy":"validation","validationCode":"// shell: raw strings must contain exactly two backticks on the line\ngrep -n '`' go.work go.mod | awk -F'`' 'NF!=3 {print \"bad raw string: \" $0; bad=1} END{exit bad}'","typeGuard":"fn is_clean_raw(s: &str) -> bool { !s.starts_with('`') || (s.matches('`').count() == 2) }","tryCatchPattern":null,"preventionTips":["Never paste markdown/shell backticks into go.work or go.mod paths","If a path contains a backtick, rename it; Go raw strings cannot encode one","Strip stray backticks when templating generates these files"],"tags":["go","parse-error","string-literal"],"backgroundTag":"invalid-argument-format","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}