{"record":{"id":"36ff6225b4f11a47","repo":"golang/go","slug":"no-clauses","errorCode":null,"errorMessage":"no clauses","messagePattern":"no clauses","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/compile/internal/inline/inlheur/scoring.go","lineNumber":121,"sourceCode":"\tif err := parseScoreAdj(base.Debug.InlScoreAdj); err != nil {\n\t\tbase.Fatalf(\"malformed -d=inlscoreadj argument %q: %v\",\n\t\t\tbase.Debug.InlScoreAdj, err)\n\t}\n}\n\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}","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/compile/internal/inline/inlheur/scoring.go#L103-L139","documentation":"Returned by parseScoreAdj when the score-adjustment flag string, split on \"/\", yields zero clauses. In practice strings.Split never returns a zero-length slice for a non-empty input (it always returns at least one element), so this branch only triggers when val is \"\". It guards the parser of the internal flag used to retune inline-heuristic adjustment scores.","triggerScenarios":"An internal flag value for inlheur score adjustments is parsed with parseScoreAdj and produces an empty clauses slice; effectively only when the flag value is the empty string passed through a code path that does not pre-filter it.","commonSituations":"Compiler development: passing -d=inlheuradjustments= (empty) or wiring the flag value from an unset environment variable. End users of released Go should never see this.","solutions":["Provide a non-empty adjustment string in the expected name:value[/name:value] form (e.g. panicPathAdj:40/initFuncAdj:20).","If the flag is optional, skip calling parseScoreAdj when the value is empty rather than parsing it.","Verify the adjustment names against the scoreAdjustTyp enum (panicPathAdj, initFuncAdj, inLoopAdj, ...)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Skip parsing an unset flag value.\nval := flag.Lookup(\"inlheuradjustments\").Value.String()\nif strings.TrimSpace(val) == \"\" {\n    return nil // no adjustments to apply\n}\nreturn parseScoreAdj(val)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat empty flag values as 'unset' before parsing.","Document the expected name:value[/name:value] syntax in the flag help text."],"tags":["go-compiler","inline-heuristics","flag-parsing","internal"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}