{"record":{"id":"eab68da1cb221d0d","repo":"go-delve/delve","slug":"syntax-error-not-found","errorCode":null,"errorMessage":"syntax error '=' not found","messagePattern":"syntax error '=' not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/command.go","lineNumber":2258,"sourceCode":"\t\tfmt.Fprintln(t.stdout, val.Type)\n\t}\n\tif val.RealType != val.Type {\n\t\tfmt.Fprintf(t.stdout, \"Real type: %s\\n\", val.RealType)\n\t}\n\tif val.Kind == reflect.Interface && len(val.Children) > 0 {\n\t\tfmt.Fprintf(t.stdout, \"Concrete type: %s\\n\", val.Children[0].Type)\n\t}\n\tif t.conf.ShowLocationExpr && val.LocationExpr != \"\" {\n\t\tfmt.Fprintf(t.stdout, \"location: %s\\n\", val.LocationExpr)\n\t}\n\treturn nil\n}\n\nfunc setVar(t *Term, ctx callContext, args string) error {\n\t// HACK: in go '=' is not an operator, we detect the error and try to recover from it by splitting the input string\n\t_, err := parser.ParseExpr(args)\n\tif err == nil {\n\t\treturn errors.New(\"syntax error '=' not found\")\n\t}\n\n\tel, ok := err.(scanner.ErrorList)\n\tif !ok || el[0].Msg != \"expected '==', found '='\" {\n\t\treturn err\n\t}\n\n\tlexpr := args[:el[0].Pos.Offset]\n\trexpr := args[el[0].Pos.Offset+1:]\n\treturn t.client.SetVariable(ctx.Scope, lexpr, rexpr)\n}\n\nfunc (t *Term) printFilteredVariables(varType string, vars []api.Variable, filter string, cfg api.LoadConfig) error {\n\treg, err := regexp.Compile(filter)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmatch := false","sourceCodeStart":2240,"sourceCodeEnd":2276,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/command.go#L2240-L2276","documentation":"The 'set' command emulates assignment by parsing the input with go/parser (since '=' is not valid Go expression syntax at top level) and rewriting it into a comparison-detected error. If the input parses cleanly as an expression there is no '=' at all — meaning the user forgot 'variable = value' — and Delve reports this error. If the parse error is not the expected \"expected '==', found '='\", the original parse error is returned instead.","triggerScenarios":"Running 'set myVar' (no '= value' part) so parser.ParseExpr succeeds with no assignment, in setVar (pkg/terminal/command.go). Also 'set a b' with no '=' triggers it.","commonSituations":"Users typing just the variable name expecting a prompt, or writing whitespace-separated assignment like 'set x 5' instead of 'set x = 5'.","solutions":["Use full assignment syntax: 'set myVar = <value>'.","Do not omit the '=' sign; 'set x 5' is invalid, 'set x = 5' is correct.","If the value itself fails to parse, note the returned error would be the go/parser error rather than this message."],"exampleFix":"// before\n(dlv) set myCounter 5\n// after\n(dlv) set myCounter = 5","handlingStrategy":"validation","validationCode":"func validateSetArgs(args string) error {\n    if !strings.Contains(args, \"=\") {\n        return fmt.Errorf(\"set requires 'lhs = rhs', got %q\", args)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := cmd.SetVar(term, ctx, args); err != nil {\n    if err.Error() == \"syntax error '=' not found\" {\n        return fmt.Errorf(\"missing '=' in set command: %q\", args)\n    }\n    return err\n}","preventionTips":["Always write assignments as 'set <var> = <value>'","Never use space-separated 'set x 5' form","Remember '=' inside the value expression is fine; the top-level lhs = rhs form is required"],"tags":["terminal","cli-usage","assignment"],"backgroundTag":"invalid-command-arguments","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}