-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use builddir/ for storing go.mod/go.sum per package
Before Before this commit, gokr-packer was building all Go binaries to include in the gokrazy root file system from the same working directory, meaning the same go.mod and go.sum files were used for all packages. This wasn’t really an intentional choice, instead it was the easiest way to get things working when Go switched from GOPATH to modules. The downside of that approach is that updates in one package can result in other packages no longer building. In the most extreme cases, it can mean that two packages cannot be built into the same gokrazy root file system at all. After With this commit, gokr-packer will build each package in a subdirectory of the new builddir/ directory in your gokrazy instance directory, e.g. ~/gokrazy/scan2drive/builddir. If there is no go.mod file in the builddir yet, gokr-packer will copy the top-level go.mod/go.sum files into the builddir to keep your current module selection, and hopefully build exactly the same binary as before. Influencing the granularity Often, one Go package will be the only package you use from a certain Go module. But this isn’t always the case: for example, the system packages github.com/gokrazy/gokrazy/cmd/dhcp and github.com/gokrazy/gokrazy/cmd/ntp both come from the github.com/gokrazy/gokrazy module. gokr-packer will by default create a separate builddir, including a separate go.mod and go.sum, for each package, even when they come from the same module. If you want to add module-wide replace directives to your go.mod file, you can influence the granularity at which gokr-packer works as follows. Move the go.mod/go.sum files to the directory level within the builddir/ hierarchy at which you would like to work. gokr-packer will look for go.mod/go.sum files at the package level, going one level up until it finds the files. Hence, you can use the following locations, ordered from finest to coarsest granularity: 1. per-package builddir (default), e.g.: builddir/github.com/gokrazy/gokrazy/cmd/dhcp/go.mod 2. per-module builddir (convenient when working with replace directives), e.g.: builddir/github.com/gokrazy/gokrazy/go.mod 3. per-org builddir (convenient for wide-reaching replace directives), e.g.: builddir/github.com/gokrazy/go.mod 4. single builddir, preserving the previous behavior, e.g.: builddir/go.mod related to #38
- Loading branch information
1 parent
0d6c95b
commit c3979e1
Showing
6 changed files
with
315 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.