{"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":null,"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/533346cc374382b41ec5ff70536252b2e96e725c/src/task/workspace/go.rs#L167-L203","documentation":"Go interpreted strings must be delimited by matching double quotes. parse_argument accepts an argument starting with `\"` only if it also ends with `\"`; otherwise it bails with 'unterminated interpreted Go string'. The parser never reads to subsequent lines, so the quote must close on the same line.","triggerScenarios":"A directive argument in go.work or go.mod starts with `\"` but the closing `\"` is missing on that line, e.g. `use \"./dir` or a quoted module path whose trailing quote was deleted.","commonSituations":"Hand-editing go.mod/go.work and dropping the closing quote; merge conflicts trimming a line; copy-paste truncation; smart-quote editors replacing `\"` with typographic quotes.","solutions":["Add the missing closing double quote: `use \"./dir\"`.","Prefer unquoted relative paths in go.work (`use ./dir`), which need no quoting.","Regenerate the file (`go work init`, `go mod tidy`) if it is badly corrupted."],"exampleFix":"// before (go.work)\nuse \"./services/api\n\n// after\nuse \"./services/api\"","handlingStrategy":"validation","validationCode":"// shell: quoted args must have balanced quotes on the same line\ngrep -nE '(^|[ \\t])(use|module)[ \\t]+\"[^\"]*$' go.work go.mod && { echo 'unterminated quoted string'; exit 1; } || true","typeGuard":"fn is_balanced_quoted(s: &str) -> bool { s.starts_with('\"') == s.ends_with('\"') && s.len() >= 2 }","tryCatchPattern":null,"preventionTips":["Prefer unquoted relative paths in go.work; quote only when the path contains spaces","Disable smart-quote substitution in editors for Go metadata files","After hand edits, run `go work sync` / `go mod tidy` to validate syntax"],"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"}