Skip to content

Commit

Permalink
How to use BP_GO_WORK_USE
Browse files Browse the repository at this point in the history
Signed-off-by: Max Brauer <[email protected]>
  • Loading branch information
mamachanko committed Feb 13, 2024
1 parent 4bb042f commit 2feefeb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions content/docs/howto/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,21 @@ cat /tmp/sbom-output/build/paketo-buildpacks_go-mod-vendor/sbom.cdx.json
{{< /code/copyable >}}
<!-- spellchecker-enable -->

## Use workspace modules
Some projects depend on multi-module workspaces and use relative `replace` directives within the same repository.
An example for this is [[email protected]](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 (...)`.

<!-- References -->
[cnb/launch-process]:https://buildpacks.io/docs/app-developer-guide/run-an-app/

Expand Down

0 comments on commit 2feefeb

Please sign in to comment.