gokrazy / tools

this repository contains the gok CLI tool of gokrazy

Home Page:https://gokrazy.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gokr-packer: Support go generate?

bzub opened this issue · comments

commented

In cases where a Go program needs to do some pre-build setup before gokr-packer installs it. The scope of this feature could be limited with --tags gokrazy so it only runs generate commands specifically intended for gokrazy.

My use case is to build/update binaries needed for wifi support (gokrazy/gokrazy#13) and pack them into Go byte slices which become available to the Go program.

I will submit a PR for this if this sounds like an OK idea.

commented

I can also see this feature being used to embed user configuration into Go programs. For example in my wifi use case the wifi Go program could look for a wifi config file on the host where gokr-packer is ran.

Hm, I’m not sure whether this should be added to the packer. Conceptually, the packer calls go get, not go generate.

You can easily combine both commands into a script — which you’ll need anyway to update from cron — like so:

PACKAGES := github.com/stapelberg/zkj-nas-tools/avr-x1100w \
	    github.com/stapelberg/hmgo

go generate ${PACKAGES}
gokr-packer -serial_console=disabled -hostname=dr -update=yes ${PACKAGES}
commented

That's true. Closing :)