请看下面的截图:
它说:
could not import C (no package data for import path C)
我在此处附上了一个重现失败的示例项目:https://github.com/microsoft/vscode/files/3783446/example-project.zip
我正在使用 Go 1.13 以及 Go 和 C/C++ 的每个扩展的最新版本。 没有编译器错误,这似乎被特别隔离为“vscode 问题”。
有没有办法解决这个 vscode 问题?
最佳答案
这是在官方 golang 包中分发的 gopls
工具中的一个错误。
这里是问题链接:
来自问题报告的信息:
internal/lsp: use Go/cgo source files instead of generated files
Using CompiledGoFiles was causing metadata lookups to fail for cgo
packages because it includes generated files in the Go build cache
when the built-in 'go list' driver is used. GoFiles includes both
Go and cgo original file names, allowing metadata lookups to
succeed.
关于c - VSCode 导入 "C"在模块上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58505317/