tools
tools copied to clipboard
gokr-packer fails when default instance (~/gokrazy/hello) exists
When gokr-packer invokes the packing logic it also calls GenerateSBOM() here.
In turn within GenerateSBOM to set the buildDir we use the instancePath obtained via config.InstancePath().
Which for gokr-packer, where no instancePath is set, it falls back to ~/gokrazy/hello.
This in turn breaks gokr-packer if ~/gokrazy/hello exists:
2023/03/12 17:34:43 open /Users/ddonati/gokrazy/hello/builddir/github.com/gokrazy/gokrazy/go.mod: no such file or directory
To reproduce:
# create the default "hello" instance at the default gokrazy instance path
gok -i hello new
# then use gokr-packer to build/overwrite something to a full file.
Thanks for the report. The command only fails if ~/gokrazy/hello exists but has no builddir, but nevertheless we should fix it.
We use the “chdir-or-fallback” logic in a number of places, so we should update at least those code paths that the old gokr-packer can reach.