Yu Xie
03/28/2023, 5:28 PMpact-go
in a monorepo/bazel environment, since it depends on pact_ffi
?
1. I saw PR attempts to bazelify pact-reference but it did not get much attention.
2. Another way I guess it might work is fetching the .a
files as static library from releases like libpact_ffi-v0.4.1 using http_archive/http_file, and then linking them through go_library/clinkopts&cdeps.
Is there an officially recommended way to do this?Matt (pactflow.io / pact-js / pact-go)
Yu Xie
03/30/2023, 12:22 AMpact_ffi
static library (i.e., <https://github.com/pact-foundation/pact-reference/releases/download/libpact_ffi-v0.4.1/libpact_ffi-osx-aarch64-apple-darwin.a.gz|libpact_ffi-osx-aarch64-apple-darwin.a.gz>
) and then tell cgo to link it properly. What would be the arguments to ask cgo to use this .a
file when linking?Yu Xie
03/30/2023, 12:32 AM/usr/local/lib -lpact_ffi
to make them point to the downloaded static library file.Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
The problem is how to override things likeI wish those arguments could be dynamic, but it seems the way cgo wants to work is that they must be pre-defined in the source code. e.g. it would be nice to allow a user to put the library wherever they want, possibly defined by an env var. I tried several variations on this but never landed on a solution. If there is a way we can update theto make them point to the downloaded static library file./usr/local/lib -lpact_ffi
lib.go
file to have locations that work for Bazel environments, i’d happily accept a PR.Yu Xie
03/31/2023, 2:43 AM/usr/local/lib
part for me. Yeah bazel support patching build files to override what you defined in lib.go
so no need for a PR here. Thanks!Matt (pactflow.io / pact-js / pact-go)
Yu Xie
03/31/2023, 5:15 PM