{"record":{"id":"9f81c78d440abd7b","repo":"jdx/mise","slug":"unterminated-raw-go-string","errorCode":null,"errorMessage":"unterminated raw Go string","messagePattern":"unterminated raw Go string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/workspace/go.rs","lineNumber":191,"sourceCode":"    if !rest.starts_with(char::is_whitespace) {\n        return None;\n    }\n    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\");","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/task/workspace/go.rs#L173-L209","documentation":"Go raw strings are delimited by backticks with no escapes. parse_argument accepts a backtick-prefixed argument only if a matching backtick closes it on the same line; otherwise it bails with 'unterminated raw Go string'.","triggerScenarios":"A directive argument in go.work/go.mod starts with a backtick (`` ` ``) but no second backtick appears on the same line, e.g. ``use `./dir``.  ","commonSituations":"Using backticks instead of double quotes by habit (backtick quoting is rarely needed for paths); an editor or shell snippet stripping a backtick; mixing quote styles across a hand-edited file.","solutions":["Close the raw string with a second backtick: `use `./dir`.","Simpler: drop the backticks and use a plain unquoted path or double quotes.","Regenerate go.work/go.mod with the go tool if corrupted."],"exampleFix":"// before (go.work)\nuse `./services/api\n\n// after\nuse `./services/api`","handlingStrategy":"validation","validationCode":"// shell\ngrep -nE '\\`[^\\`]*$' go.work go.mod && { echo 'unterminated raw string'; exit 1; } || true","typeGuard":"fn is_closed_raw(s: &str) -> bool { !s.starts_with('`') || (s.len() >= 2 && s.ends_with('`')) }","tryCatchPattern":null,"preventionTips":["Use double quotes, not backticks, for go.work/go.mod string arguments","Backtick-quote only single-line values and count both delimiters","Validate with `go work sync` after edits"],"tags":["go","parse-error","string-literal"],"backgroundTag":"schema-validation-failed","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"}