-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
RFC: Replace cgo with ebitengine/purego #452
Comments
We are currently using the pact-jvm implementation and in the process of migrating our codebase to Golang. pact-go forces us to use CGO which is otherwise unnecessary and also undesirable. Dropping CGO as a requirement would be very useful for us. |
The purego project is still in beta, and cgo is officially supported by the golang team. What does your team do in situations where they require cgo functionality, or programs with cgo functionality (bearing in mind this is test, not production code). Is there a blanket ban, or would you seek to rewrite in pure golang. pact-go isn't forcing you per sai, it's just a the official mandatory pre-requisite of building any project in golang, which requires bindings to a c language. I wish cgo and the golang project, had a better delivery mechanism for golang based projects, which deliver c bindings via cgo, but alas, we are where we are. It's why the pact-go project requires an install step in pact-go v2, which is probably suboptimal from a newbie users perspective. I would like to provide a fallback, for non cgo users such as yourself and especially for windows users where cgo is an inconvenience to setup and use with pact-go, but I can also see a case whereby a user may want to use the non-cgo bindings of pact-go, but still rely on cgo based features in a test suite, such as golangs race detector (which enabling, seems to be the general recommendation when testing with go) references for the race detectors libc/cgo dependency
So we may want to support use cases of
|
Rationale
since pact-go v2 was created, we rely on functionality from a rust shared core, which is delivered by way of C shared library, and is loaded via FFI (Foreign Function Interface) via cgo, into pact-go.
This has meant that users have to explicitly enable cgo, and those who cannot install or do have a c compiler installed, have been unable to use pact-go v2.
See #321 for a related issue.
Alternatives
Leveraging ebitengine/purego
Options
End users experience
Currently users need to
CGO_ENABLED=1
With ebitengine/purego, the user just needs to perform 3, and in step 4, they can point pact-go at wherever the shared library lives with no restrictions. This means it can be in non-standard paths, different versions could easily be managed.
Due to size reduces in the native libraries, we could possibly include the shared libraries in the code base. it would inflate the git history, but would make it very easy for uses to just plug and play with pact-go
The text was updated successfully, but these errors were encountered: