When calling the gopacakgesdriver on a file which has cgo dependencies the response is:
- Missing the generated
_cgo_gotypes.go files which contain the types in the CompiledFiles and its imports are missing in the Imports.
- Contains the generated
*.cgo1.go files in both the GoFiles and CompiledFiles, when they should only be in the CompiledFiles.
- is missing the original go source files in the GoFiles.
The 1st item leads to issues where the imports that the ExportFile expects are not present in the Imports of the package. This causes errors like the following to be surfaced when running tools via gopackagesdriver.
testifylint: golang.org/x/tools/go/packages: unexpected new packages during load of github.com/confluentinc/confluent-kafka-go/v2/kafka
panic: golang.org/x/tools/go/packages: unexpected new packages during load of github.com/confluentinc/confluent-kafka-go/v2/kafka
goroutine 431 [running]:
log.Panicf({0x9358cb?, 0x33?}, {0x1ce2f277c20?, 0x8?, 0x1ce2eef2880?})
log/log.go:460 +0x74
golang.org/x/tools/go/packages.(*loader).loadFromExportData(0x1ce2efd6180, 0x1ce2f816340)
pkg/linux_amd64/golang.org/x/tools/go/packages/packages.go:1553 +0x63e
golang.org/x/tools/go/packages.(*loader).loadPackage(0x1ce2efd6180, 0x1ce2f816340)
pkg/linux_amd64/golang.org/x/tools/go/packages/packages.go:1079 +0x645
golang.org/x/tools/go/packages.(*loader).refine.func2.1()
pkg/linux_amd64/golang.org/x/tools/go/packages/packages.go:945 +0x2d
golang.org/x/sync/errgroup.(*Group).Go.func1()
pkg/linux_amd64/golang.org/x/sync/errgroup/errgroup.go:93 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 430
pkg/linux_amd64/golang.org/x/sync/errgroup/errgroup.go:78 +0x95
I have a fix for all these issues on my fork.
When calling the gopacakgesdriver on a file which has cgo dependencies the response is:
_cgo_gotypes.gofiles which contain the types in the CompiledFiles and its imports are missing in the Imports.*.cgo1.gofiles in both the GoFiles and CompiledFiles, when they should only be in the CompiledFiles.The 1st item leads to issues where the imports that the ExportFile expects are not present in the Imports of the package. This causes errors like the following to be surfaced when running tools via gopackagesdriver.
I have a fix for all these issues on my fork.