From 76254819cc760a35cf5964f996dcfa07a1423b5b Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Thu, 4 Jul 2024 12:43:19 +0100 Subject: [PATCH 1/2] docs: Add cgo pre-reqs and tips for macos/windows --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6382d5f4c..97067d3ec 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,10 @@ go get github.com/pact-foundation/pact-go/v2 # install CLI tools go install github.com/pact-foundation/pact-go/v2 -# download and install the required libraries. The pact-go will be installed into $GOPATH/bin, which is $HOME/go/bin by default. -pact-go -l DEBUG install +# pact-go will be installed into $GOPATH/bin, which is $HOME/go/bin by default. + +# download and install the required libraries. +pact-go -l DEBUG install # 🚀 now write some tests! ``` @@ -98,6 +100,51 @@ export PATH=$PATH:$GOPATH/bin You can also keep the library versions up to date by running the `version.CheckVersion()` function. +Set `PACT_GO_LIB_DOWNLOAD_PATH` env var if you have installed the library in a non-standard location. + +
Pre-Requisites + +### Pre-Requisites + +- `cgo` + - Pact relies on C shared libraries compiled from Rust + - `CGO_ENABLED=1` (check with `go env`) + +#### Linux + +- Install `gcc` package + +#### MacOS + +- Install the Xcode Command line tools + +By default, pact-go install will attempt to install in `/usr/local/lib`. + +Note this is not user-writable, so `pact-go install` must be run with `sudo`. + +An alternative is to install to `/tmp` via `pact-go -l DEBUG install --libDir /tmp` + +#### Windows + +- Install `gcc` + - `choco install mingw` + - `scoop install mingw` + +- Add location of the pact-go installed shared library to + - `PATH` + - `CGO_LDFLAGS` + +##### Powershell + +- `$env:Path += ';$env:TMP'` +- `$env:CGO_LDFLAGS = '-L$env:TMP'` + +- Command Prompt +- `set %PATH% = '%PATH%;%TMP%'` +- `set %CGO_LDFLAGS% = '-L%TMP%` + +
+
Manual Installation Instructions ### Manual From 15e796f1410d7d2e78d63be771bb7b6eb47da47a Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Thu, 4 Jul 2024 17:19:49 +0100 Subject: [PATCH 2/2] docs: correct env vars for win --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 97067d3ec..daf8e18b0 100644 --- a/README.md +++ b/README.md @@ -136,12 +136,12 @@ An alternative is to install to `/tmp` via `pact-go -l DEBUG install --libDir /t ##### Powershell -- `$env:Path += ';$env:TMP'` -- `$env:CGO_LDFLAGS = '-L$env:TMP'` +- `$env:Path += ";$env:TMP"` +- `$env:CGO_LDFLAGS = "-L$env:TMP"` - Command Prompt -- `set %PATH% = '%PATH%;%TMP%'` -- `set %CGO_LDFLAGS% = '-L%TMP%` +- `set PATH="%PATH%;%TMP%"` +- `set CGO_LDFLAGS="-L%TMP%"`