{"record":{"id":"dea2c8f9cae8561e","repo":"golangci/golangci-lint","slug":"unknown-locale-q","errorCode":null,"errorMessage":"unknown locale: %q","messagePattern":"unknown locale: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/golinters/misspell/misspell.go","lineNumber":58,"sourceCode":"\t\t}).\n\t\tWithLoadMode(goanalysis.LoadModeSyntax)\n}\n\nfunc createMisspellReplacer(settings *config.MisspellSettings) (*misspell.Replacer, error) {\n\treplacer := &misspell.Replacer{\n\t\tReplacements: misspell.DictMain,\n\t}\n\n\t// Figure out regional variations\n\tswitch strings.ToUpper(settings.Locale) {\n\tcase \"\":\n\t\t// nothing\n\tcase \"US\":\n\t\treplacer.AddRuleList(misspell.DictAmerican)\n\tcase \"UK\", \"GB\":\n\t\treplacer.AddRuleList(misspell.DictBritish)\n\tcase \"NZ\", \"AU\", \"CA\":\n\t\treturn nil, fmt.Errorf(\"unknown locale: %q\", settings.Locale)\n\t}\n\n\terr := appendExtraWords(replacer, settings.ExtraWords)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"process extra words: %w\", err)\n\t}\n\n\tif len(settings.IgnoreRules) != 0 {\n\t\treplacer.RemoveRule(settings.IgnoreRules)\n\t}\n\n\t// It can panic.\n\treplacer.Compile()\n\n\treturn replacer, nil\n}\n\nfunc runMisspellOnFile(pass *analysis.Pass, file *ast.File, replacer *misspell.Replacer, mode string) error {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/golinters/misspell/misspell.go#L40-L76","documentation":"The misspell linter only supports locale configuration for US or UK/GB English dictionaries. createMisspellReplacer explicitly rejects NZ, AU, CA (and any other string) as an unsupported locale, returning this error from the linter constructor New, so golangci-lint fails to initialize misspell.","triggerScenarios":"Setting linters-settings.misspell.locale to \"NZ\", \"AU\", \"CA\", or any value not in {\"US\", \"UK\", \"GB\", \"\"} in .golangci.yml.","commonSituations":"Developers outside US/UK assuming their country code is a valid locale (AU/NZ/CA are listed only to give a clear error); typos like \"us-EN\" or \"en_US\"; config copied from tools that do support those locales.","solutions":["Change locale to \"US\" for American spelling or \"UK\"/\"GB\" for British spelling in .golangci.yml.","Remove the locale setting entirely to use the default (both dictionaries considered).","Handle regional differences via misspell's extra-words config instead of an unsupported locale.","Run `golangci-lint config verify` or docs check to catch unsupported values before running."],"exampleFix":"# before\nlinters-settings:\n  misspell:\n    locale: AU\n# after\nlinters-settings:\n  misspell:\n    locale: UK","handlingStrategy":"validation","validationCode":"func validLocale(l string) bool {\n    switch l {\n    case \"\", \"US\", \"UK\", \"GB\":\n        return true\n    }\n    return false\n}\nif !validLocale(cfg.Misspell.Locale) { return fmt.Errorf(\"unsupported locale %q\", cfg.Misspell.Locale) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only set locale to US, UK, or GB in misspell settings.","Omit the locale key entirely for default behavior.","Run `golangci-lint config verify` in CI before linting.","Handle AU/NZ/CA differences via extra-words entries instead of locale."],"tags":["golang","linter","misspell","configuration"],"backgroundTag":"unsupported-locale","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}