tools icon indicating copy to clipboard operation
tools copied to clipboard

gokr-packer fails when default instance (~/gokrazy/hello) exists

Open damdo opened this issue 2 years ago • 1 comments

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.

damdo avatar Mar 12 '23 16:03 damdo

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.

stapelberg avatar Mar 13 '23 07:03 stapelberg