{"record":{"id":"9f2587a7dab65fc1","repo":"golang/go","slug":"clause-q-expected-colon","errorCode":null,"errorMessage":"clause %q: expected colon","messagePattern":"clause %q: expected colon","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/compile/internal/inline/inlheur/scoring.go","lineNumber":126,"sourceCode":"\nfunc adjStringToVal(s string) (scoreAdjustTyp, bool) {\n\tfor adj := scoreAdjustTyp(1); adj < sentinelScoreAdj; adj <<= 1 {\n\t\tif adj.String() == s {\n\t\t\treturn adj, true\n\t\t}\n\t}\n\treturn 0, false\n}\n\nfunc parseScoreAdj(val string) error {\n\tclauses := strings.Split(val, \"/\")\n\tif len(clauses) == 0 {\n\t\treturn fmt.Errorf(\"no clauses\")\n\t}\n\tfor _, clause := range clauses {\n\t\telems := strings.Split(clause, \":\")\n\t\tif len(elems) < 2 {\n\t\t\treturn fmt.Errorf(\"clause %q: expected colon\", clause)\n\t\t}\n\t\tif len(elems) != 2 {\n\t\t\treturn fmt.Errorf(\"clause %q has %d elements, wanted 2\", clause,\n\t\t\t\tlen(elems))\n\t\t}\n\t\tadj, ok := adjStringToVal(elems[0])\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"clause %q: unknown adjustment\", clause)\n\t\t}\n\t\tval, err := strconv.Atoi(elems[1])\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"clause %q: malformed value: %v\", clause, err)\n\t\t}\n\t\tadjValues[adj] = val\n\t}\n\treturn nil\n}\n","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/compile/internal/inline/inlheur/scoring.go#L108-L144","documentation":"Returned by parseScoreAdj for a single score-adjustment clause that has no colon, i.e. strings.Split(clause, \":\") produced fewer than 2 elements. Each clause must look like <adjustmentName>:<integer>, so a missing colon means the clause is malformed.","triggerScenarios":"An inlheur adjustment clause like \"panicPathAdj\" (no \":value\") is parsed; len(elems) < 2 fires the error naming the offending clause.","commonSituations":"Compiler development: typo in the -d=inlheuradjustments flag value, missing the value half, or copy-paste dropping the colon.","solutions":["Rewrite the clause as name:value, e.g. panicPathAdj:40.","Separate multiple clauses with / and ensure each has exactly one colon.","Cross-check names against the scoreAdjustTyp String() outputs."],"exampleFix":"// before\n-d=inlheuradjustments=panicPathAdj\n// after\n-d=inlheuradjustments=panicPathAdj:40","handlingStrategy":"validation","validationCode":"// Pre-validate each clause has exactly one colon.\nfor _, c := range strings.Split(val, \"/\") {\n    if !strings.Contains(c, \":\") {\n        return fmt.Errorf(\"clause %q missing ':'\", c)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair an adjustment name with an integer value separated by a single colon.","Document example flag values next to the scoreAdjustTyp enum."],"tags":["go-compiler","inline-heuristics","flag-parsing","internal"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:17:08.281Z"}