Skip to content

Conversation

@gauron99
Copy link
Contributor

@gauron99 gauron99 commented Sep 29, 2025

Summary

Introduce new BP_GO_WORKDIR which can be set as a relative subpath of the whole working directory (--path) as a path where go build will be build from. Meaning effectively cd into subdir && go build... happens.

Use Cases

Use case for mono repos and non-standard repos. The current implementation lacks option for main package to be different to the root of the project.

If a repo has non-standard dependency -- eg. when root is not the "main" package the build fails -- it expects the root to be the main package and derives its dependency tree in standard manner: from root to subdirs. If a repo uses non-standard go dependency tree it needs to build in the main package which means, in this case, from sub directory and this is what BP_GO_WORKDIR aims to enable; differentiate context directory (--path when pack building) and go workdir directory.

fixes #879

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

@gauron99 gauron99 requested a review from a team as a code owner September 29, 2025 16:16
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 29, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: gauron99 / name: David Fridrich (cf17397)

@gauron99 gauron99 force-pushed the push-uswkxpsnlqtm branch 2 times, most recently from d62b666 to 4a0d2a7 Compare October 1, 2025 12:20
@dmikusa dmikusa added the semver:minor A change requiring a minor version bump label Oct 1, 2025
@jericop jericop merged commit 63a2483 into paketo-buildpacks:main Oct 1, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver:minor A change requiring a minor version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an optional working directory environment variable for go

3 participants