CGO-Finder is a tool that helps identify and analyze CGo usage in Go project dependencies, including indirect dependencies.
Using dependencies that utilize CGo or have dependencies that rely on CGo can introduce challenges in terms of deployability and portability of the code. While it may be necessary to use such dependencies in certain cases, it is generally recommended to prioritize pure Go alternatives whenever possible.
Some of the negative consequences of relying on CGo dependencies include:
- Inability to cross-compile the code for different platforms.
- Difficulty in creating minimal container images for deployment.
There is no straight forward way to identify which dependencies
It's not easy to find dependencies that use CGo. This tool was made to address this need.
- Change current directory to the one that contains your code base and
go.mod
Make sure all dependencies are present by runninggo mod download
- Install cgo-finder:
go install github.com/spring1843/cgo-finder@latest
- Run the tool to generate report
cgo-finder