Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: Switch from makefile to go generate instructions #163

Open
matheusd opened this issue Jun 20, 2024 · 3 comments
Open

Idea: Switch from makefile to go generate instructions #163

matheusd opened this issue Jun 20, 2024 · 3 comments

Comments

@matheusd
Copy link
Contributor

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.

@deneonet
Copy link
Collaborator

deneonet commented Jun 20, 2024

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.

@matheusd
Copy link
Contributor Author

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).

@deneonet
Copy link
Collaborator

Didn't think about running a go program inside go generate, then there should be no issues. PR is welcomed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants