簡體   English   中英

gosec 給出“無法導入 C(C 沒有元數據)”golang 錯誤

[英]gosec giving “could not import C (no metadata for C)” golang error

我在我的項目上運行 gosec 但它給出了以下錯誤,因為我們的管道失敗了

文件中的 Golang 錯誤:[/home/usr/exmaple/project.go]:

[第 22 行:第 8 列] - 無法導入 C(沒有 C 的元數據)

而 go 構建命令成功構建項目意味着沒有 golang 錯誤。

這似乎也是其他人遇到的錯誤。 請參閱此問題問題。 您可能也應該為此向 gosec 報告問題。 或者可能直接在 Go 存儲庫中的go/packages package 。

這不是問題。

We found out that our C code is present in.c and.h files in package directory, where.h file containing only function prototypes. 我們在 go 文件 (cgo) 中包含 only.h 文件。

go build and go test commands are working because both of these commands when see.c and.h in package directory, compiles and link them. But gosec is a SAST tool, it doesn't compile.c and.h files present in package directory due to this gosec scan was getting only function prototypes not definition and was throwing Golang error could not import C (no metadata for C).

在注釋中包含整個代碼 (CGO) 有效。 現在 gosec 工作正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM