From 2feefebdeeae73281ec6d9daf0e96f3833c9ad41 Mon Sep 17 00:00:00 2001 From: Max Brauer Date: Tue, 13 Feb 2024 16:40:54 +0100 Subject: [PATCH] How to use BP_GO_WORK_USE Signed-off-by: Max Brauer --- content/docs/howto/go.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/content/docs/howto/go.md b/content/docs/howto/go.md index ab49398d..26fdd115 100644 --- a/content/docs/howto/go.md +++ b/content/docs/howto/go.md @@ -423,6 +423,21 @@ cat /tmp/sbom-output/build/paketo-buildpacks_go-mod-vendor/sbom.cdx.json {{< /code/copyable >}} +## Use workspace modules +Some projects depend on multi-module workspaces and use relative `replace` directives within the same repository. +An example for this is [cert-manager@v1.13.3](https://github.com/cert-manager/cert-manager/tree/v1.13.3). +In such case you may want to initialise and use workspace modules prior to building. + +With `BP_GO_WORK_USE` the Go buildpack can be configured to `go work use (...)` certain modules before building. + +{{< code/copyable >}} +pack build my-app --buildpack paketo-buildpacks/go \ + --env BP_GO_WORK_USE=./cmd/my-module \ + --env BP_GO_TARGETS=./cmd/my-module +{{< /code/copyable >}} + +It will run `go work init` before running `go work use (...)`. + [cnb/launch-process]:https://buildpacks.io/docs/app-developer-guide/run-an-app/