{"record":{"id":"0cd08c9c75fc9837","repo":"golang/go","slug":"unrecognized-compiler-q","errorCode":null,"errorMessage":"unrecognized compiler %q","messagePattern":"unrecognized compiler %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/script/conds.go","lineNumber":56,"sourceCode":"\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\tif _, ok := syslist.KnownArch[suffix]; !ok {\n\t\t\t\treturn false, fmt.Errorf(\"unrecognized GOARCH %q\", suffix)\n\t\t\t}\n\t\t\treturn false, nil\n\t\t})\n\n\tconds[\"compiler\"] = PrefixCondition(\n\t\t\"runtime.Compiler == <suffix>\",\n\t\tfunc(_ *State, suffix string) (bool, error) {\n\t\t\tif suffix == runtime.Compiler {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\tswitch suffix {\n\t\t\tcase \"gc\", \"gccgo\":\n\t\t\t\treturn false, nil\n\t\t\tdefault:\n\t\t\t\treturn false, fmt.Errorf(\"unrecognized compiler %q\", suffix)\n\t\t\t}\n\t\t})\n\n\tconds[\"root\"] = BoolCondition(\"os.Geteuid() == 0\", os.Geteuid() == 0)\n\n\treturn conds\n}\n\n// Condition returns a Cond with the given summary and evaluation function.\nfunc Condition(summary string, eval func(*State) (bool, error)) Cond {\n\treturn &funcCond{eval: eval, usage: CondUsage{Summary: summary}}\n}\n\ntype funcCond struct {\n\teval  func(*State) (bool, error)\n\tusage CondUsage\n}\n","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/script/conds.go#L38-L74","documentation":"Thrown by the compiler prefix condition in DefaultConds. The condition accepts only the two Go compiler toolchains — 'gc' (the standard compiler) and 'gccgo'. Any other suffix errors at conds.go:52-57 because there is no third compiler to compare against.","triggerScenarios":"Writing [compiler:<x>] with a value other than the current runtime.Compiler and not in {gc, gccgo}, e.g. [compiler:gcc], [compiler:llvm], or [compiler:tinygo].","commonSituations":"Confusing the Go compiler name with a C compiler (gcc); referencing an experimental or third-party Go compiler that the script engine does not know; typo such as [compiler:gccgoo].","solutions":["Use exactly 'gc' or 'gccgo' as the suffix.","If you need to detect a third-party compiler, register a custom condition rather than overloading 'compiler'.","Verify the current value with runtime.Compiler to understand which branch will be taken."],"exampleFix":"// before\n[compiler:gcc] exec go build\n// after\n[compiler:gccgo] exec go build","handlingStrategy":"validation","validationCode":"func validCompiler(v string) bool {\n    return v == \"gc\" || v == \"gccgo\"\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember only 'gc' and 'gccgo' are valid compiler condition suffixes.","Do not confuse the Go compiler name with a C compiler like gcc."],"tags":["go-script-test","conditions","compiler","go-toolchain"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}