Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法支持Cgo项目 #158

Open
ningque123456 opened this issue Mar 26, 2024 · 6 comments
Open

无法支持Cgo项目 #158

ningque123456 opened this issue Mar 26, 2024 · 6 comments

Comments

@ningque123456
Copy link

2024-03-26 14:18:07,646 [2088286] WARN - go-linter - Run error: level=warning msg="The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner. "
level=warning msg="The linter 'maligned' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner. Replaced by govet 'fieldalignment'."
level=error msg="[linters_context] typechecking error: D:\light\alphamon\impls\execute_cmd.go:7:2: could not import alphawolf.com/alpha/hx (-: # alphawolf.com/alpha/hx\n..\..\alpha\hx\hxclient.go:479:9: undefined: GetMessageAuth\n..\..\alpha\hx\hxmsg.go:43:14: undefined: GetMessageAuth\n..\..\alpha\hx\hxmsg.go:1220:14: undefined: GetMessageAuth\n..\..\alpha\hx\hxmsg.go:1228:25: undefined: GetMessageAuth\n..\..\alpha\hx\hxmsg.go:1268:11: undefined: GetMessageAuth)"
level=error msg="[linters_context] typechecking error: D:\light\alphamon\impls\t3_conn.go:16:18: undefined: CConnection"
level=error msg="[linters_context] typechecking error: D:\light\alphamon\impls\t3_conn.go:24:20: undefined: T3Client"
level=error msg="[linters_context] typechecking error: D:\light\alphamon\impls\bulk_operation.go:1571:18: undefined: T3Client"
level=error msg="[linters_context] typechecking error: D:\light\alphamon\impls\execute.go:1567:15: undefined: T3Client"
level=error msg="[linters_context] typechecking error: D:\light\alphamon\impls\t3_conn.go:31:2: undefined: ConfigRelease"
level=error msg="[linters_context] typechecking error: D:\light\alphamon\impls\t3_conn.go:32:2: undefined: ConnectionRelease"
level=error msg="[linters_context] typechecking error: D:\light\alphamon\impls\t3_conn.go:66:27: undefined: T3Client"
level=error msg="[linters_context] typechecking error: D:\light\alphamon\impls\t3_conn.go:110:29: undefined: T3Client"
level=warning msg="[runner] Can't run linter goanalysis_metalinter: buildir: failed to load package hx: could not load export data: no export data for "alphawolf.com/alpha/hx""
level=warning msg="[linters_context] interfacer: This linter is fully inactivated: it will not produce any reports."
level=warning msg="[linters_context] maligned: This linter is fully inactivated: it will not produce any reports."
level=error msg="Running error: can't run linter goanalysis_metalinter\nbuildir: failed to load package hx: could not load export data: no export data for "alphawolf.com/alpha/hx""
. Please make sure the project has no syntax error.

这几个undefined错误是通过Cgo引用的C语言动态链接库,导致插件无法正常工作。
但是直接在控制台执行golangci-lint.exe run 是可以的

@xxpxxxxp
Copy link
Owner

Hi @ningque123456 , 可以分享一个样例工程吗,一两个文件可以复现bug就好

@ningque123456
Copy link
Author

image
image
第一个图片是日志,第二个是Cgo子工程,只有一个.c文件和一个.go文件。可以正常运行
image

@xxpxxxxp
Copy link
Owner

Hi @ningque123456 ,抱歉最近太忙了,刚来的及看
我测试了一下这样的example project里面plugin是正常工作的
你提供的截图里面有一行可疑的log
typechecking error: build constraints exclude all Go files in ....

麻烦提供一下Build Tags截图,可能是当前所选的build tag导致的问题

image

@ningque123456
Copy link
Author

image

@xxpxxxxp
Copy link
Owner

OK可以看到当前是在windows下,当前报错的文件有没有build constraints,eg
//+build
//go:build

@ningque123456
Copy link
Author

没有

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants