{"record":{"id":"227bf05fdbe4f105","repo":"golangci/golangci-lint","slug":"no-export-data-for-q","errorCode":null,"errorMessage":"no export data for %q","messagePattern":"no export data for %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/goanalysis/runner_loadingpackage.go","lineNumber":245,"sourceCode":"\t// Call NewPackage directly with explicit name.\n\t// This avoids skew between golist and go/types when the files'\n\t// package declarations are inconsistent.\n\t// Subtle: we populate all Types fields with an empty Package\n\t// before loading export data so that export data processing\n\t// never has to create a types.Package for an indirect dependency,\n\t// which would then require that such created packages be explicitly\n\t// inserted back into the Import graph as a final step after export data loading.\n\tpkg.Types = types.NewPackage(pkg.PkgPath, pkg.Name)\n\n\tpkg.IllTyped = true\n\tfor path, pkg := range pkg.Imports {\n\t\tif pkg.Types == nil {\n\t\t\treturn fmt.Errorf(\"dependency %q hasn't been loaded yet\", path)\n\t\t}\n\t}\n\n\tif pkg.ExportFile == \"\" {\n\t\treturn fmt.Errorf(\"no export data for %q\", pkg.ID)\n\t}\n\n\tf, err := os.Open(pkg.ExportFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tr, err := gcexportdata.NewReader(f)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tview := make(map[string]*types.Package)  // view seen by gcexportdata\n\tseen := make(map[*packages.Package]bool) // all visited packages\n\tvar visit func(pkgs map[string]*packages.Package)\n\tvisit = func(pkgs map[string]*packages.Package) {\n\t\tfor _, pkg := range pkgs {","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/goanalysis/runner_loadingpackage.go#L227-L263","documentation":"A package in the export-data loading pass has an empty ExportFile path, so golangci-lint cannot read its compiled type information. Export data is required to reconstruct the types.Package without recompiling from source.","triggerScenarios":"loadFromExportData finds pkg.ExportFile == \"\" — the package has no export data file, typically because it was never built or is a synthetic/no-op package (e.g. unsafe, or a package excluded from the build).","commonSituations":"Package not compiled because of build constraints/tags mismatch; go/packages driver returning incomplete responses; linting with custom build tags where some deps are excluded.","solutions":["Ensure the package actually builds: `go build ./...` with the same tags used by the linter","Align build tags/GOOS/GOARCH between the lint invocation and the build","Update golangci-lint and x/tools (export data loading fixes ship there)","Run `go clean -cache` to force fresh export data generation"],"exampleFix":"// before: lint with tags\n// golangci-lint run\n// after: pass the same build tags\ngolangci-lint run --build-tags=integration","handlingStrategy":"validation","validationCode":"// ensure all packages build and export data exists before lint\nexec.Command(\"go\", \"build\", \"./...\").Run()","typeGuard":null,"tryCatchPattern":"// surface hint: check build tags alignment\nif strings.Contains(err.Error(), \"no export data\") {\n    log.Print(\"align --build-tags/GOOS with your build; rebuild deps\")\n}","preventionTips":["Pass the same build tags to golangci-lint as to go build","Keep GOOS/GOARCH consistent in CI","Update golangci-lint/x/tools regularly"],"tags":["golangci-lint","export-data","package-loading"],"backgroundTag":"missing-export-data","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}