Open matheusd opened 2 months ago
I think the Makefile has to be redone anyways, because of the new structure of the repo. But im unsure how to get go generate
to work cross-platform.
Not sure what the issue with different platforms would be.
A standard directive would be something like //go:generate protoc --go_out=. structdef.proto
from inside a package, so a go generate ./...
would work just like in the makefile.
More complex generators could do something like //go:generate go run -tag build buildstuff.go
, where buildstuff.go
is a standard go program that will perform whatever complex task is needed to generate the bindings.
Some of the generators require third party programs to be installed (e.g. protoc) but that's no different than the current situation (and can be solved either through the prior method or some clever go module requirements).
Didn't think about running a go program inside go generate, then there should be no issues. PR is welcomed!
Instead of relying on a makefile to generate bindings for the serializers that rely on code generation, we should move those instructions into each serializer package, so that it is their responsibility to keep them correct and up to date and also include instructions on the necessary setup needed to perform the codegen.
This would make the project more in line with purely go projects, removing the need to rely on an additional tool (
make
) to completely rebuild the project.