I understand that before compiling go run build.go assets is required, but as far as I understand this manual fireing of go commands it not supported by the build system. On the other hand, go generate is supported but doesn’t seem to create the required assets, as I hoped.
Is it possible to automatically create the assets if missing or ignore them and use an external folder instead, as for development mode?
Not really, no. We could however make go generate do the right thing. Even so, without going through the build script the resulting binary will have no version information and generally be “unsupported” from our point of view.
Note that you probably don’t want to do go generate on the whole source tree, just on the on or two relevant packages. You can use the build script to show you what commands it does;
jb@kvin:~/s/g/s/syncthing $ BUILDDEBUG=1 go run build.go build syncthing
runError: git describe --always --dirty
... in 26.227163ms
runError: git branch -a --contains
... in 130.495707ms
runError: git show -s --format=%ct
... in 6.753972ms
runPrint: go generate github.com/syncthing/syncthing/lib/auto github.com/syncthing/syncthing/cmd/strelaypoolsrv/auto
... in 857.033196ms
rm -r syncthing
runPrint: go build -i -v -ldflags -w -X main.Version=v0.14.49-rc.2+7-gaed5c1a5-gogen -X main.BuildStamp=1529997922 -X main.BuildUser=jb -X main.BuildHost=kvin.kastelo.net github.com/syncthing/syncthing/cmd/syncthing
github.com/syncthing/syncthing/lib/auto
github.com/syncthing/syncthing/cmd/syncthing
... in 1.463617588s
... build completed in 2.329006744s
jb@kvin:~/s/g/s/syncthing $
(With the right version etc for you.) Odd quoting because the whole thing after -ldflags up to the package name is actually the value for the -ldflags parameter (not visible in the build script debug output).
Yeah, it’s mostly to identify where the binary is from. openwrt@openwrt is perfectly fine unless you want something more detailed (like if there are different openwrt distributions or something).