Before this commit, the mere presence of files with certain names in local
package directories would make the build fail (see nonmodulefiles_test.go).
With this commit, we now record the buildinfo and buildid of all built Go
programs of this gokrazy instance.
related to https://github.com/gokrazy/gokrazy/issues/297
fixes https://github.com/gokrazy/gokrazy/issues/299
This fixes errors such as:
2024/09/11 08:41:50 Error: build directory
"/home/michael/gokrazy/router7/builddir/github.com/stapelberg/prober7/cmd/probe"
does not exist in
"/home/michael/gokrazy/router7/builddir/github.com/gokrazy/serial-busybox"
prior to this commit SBOMs would have inconsistency in their hashing on
the configuration file.
The representation of the config file in fact would differ at certain
stages of the gok commands lifecycle, where at packer running time,
an extra InternalCompatibilityFlag, Sudo, would be added in memory
(while that not being the case at `gok sbom` time),
resulting in a differing config and as such differing SBOM hashes, same
goes for the differing pointer addresses that were skew the hashing
results.
This is now fixed by using the SudoOrDefault() accessor,
as well as converting the config into a string before computing the hash,
to avoid differing pointer problems.
We do this by using the dirhash package, but filtering out any hidden
files (starting with .) and using hash/fnv because we are not interested in
cryptographically secure hashes of local directory contents, just whether the
contents changed.
fixes https://github.com/gokrazy/gokrazy/issues/171