{"record":{"id":"f7fd979081d25716","repo":"jdx/mise","slug":"unterminated-interpreted-go-string","errorCode":null,"errorMessage":"unterminated interpreted Go string","messagePattern":"unterminated interpreted Go string","errorType":"validation","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/task/workspace/go.rs","lineNumber":185,"sourceCode":"\n    module_path.ok_or_else(|| eyre::eyre!(\"Go module metadata is missing a module directive\"))\n}\n\nfn directive_arguments<'a>(line: &'a str, directive: &str) -> Option<&'a str> {\n    let rest = line.strip_prefix(directive)?;\n    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","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/task/workspace/go.rs#L167-L203","documentation":"parse_argument treats arguments starting with a double quote as Go interpreted strings and requires a matching closing double quote; strip_suffix('\"') failing raises this error. The quoted use/module argument was opened but never closed, so the token cannot be tokenized as one path.","triggerScenarios":"go.work contains `use \"./api` (opening quote, no closer); inside a `use (...)` block a line consisting of a single stray `\"`; a truncated line where the trailing quote was cut off.","commonSituations":"Typing a quote intending to handle a path with spaces and forgetting the closer; partial copy-paste of an entry; editor auto-pairing being disabled or deleted by a later edit.","solutions":["Close the string: `use \"./api\"`","Only quote when the path actually contains spaces or special characters; plain `use ./api` needs no quotes","Re-run `go work sync` to have the toolchain report the malformed line as well"],"exampleFix":"# before (go.work)\nuse \"./api\n\n# after\nuse \"./api\"","handlingStrategy":"validation","validationCode":"fn quotes_balanced(token: &str) -> bool {\n    if let Some(body) = token.strip_prefix('\"') {\n        body.ends_with('\"')\n    } else {\n        true\n    }\n}\n\nfor dir in use_arguments { assert!(quotes_balanced(dir)); }","typeGuard":"fn is_closed_interpreted_string(token: &str) -> bool {\n    token.strip_prefix('\"').is_none_or(|body| body.ends_with('\"') && !body.ends_with(\"\\\\\\\"\"))\n}","tryCatchPattern":"Err(report) if report.to_string().contains(\"unterminated interpreted Go string\") => {\n    // quote is optional for simple paths: strip the dangling opener and retry\n    let token = token.trim_start_matches('\"');\n    directories.push(PathBuf::from(token));\n}","preventionTips":["Quote go.work arguments only when the path contains spaces or special characters","Pair quotes as you type; editors with auto-pairing help","Prefer unquoted ./dir paths"],"tags":["go","go-work","parse","string-literal","syntax"],"backgroundTag":"unterminated-string-literal","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}