Protobufs for Go

I posted recently about building a CLI in Go to make it easier to compile to executables across different OSs and not require Python. Someone asked about the possibility of spinning out part of the code into a Go API and I’ve started the process, but I’ve run into a roadblock with the Protobufs.

The CLI and the Package both require the compiled Protobufs to work fully, and right now I just have the compiled Go files committed to each repository. I was thinking that it would be nice to create another Go package to import just the compiled Protobuf files instead of pinning to a certain version of the original repository.

One of the reasons for making a new package is that to compile Protobufs to Go code there has to be a new option added to each file:

option go_package = "github.com/lmatte7/meshtastic-go"

I could add a line like this in a PR to the Protobuf repo, but it wouldn’t import correctly in Go after the files are compiled. Developers would have to change this line to something different in their local code to set up local imports correctly.

The other reason I think a new package would be beneficial is it should allow any potential users the ability to skip compiling the files completely and just grab the code as needed to talk to the radio. I’d imagine this package should live in the Meshtastic Github organization as well.

I’d love to get some feedback on my idea and see what people think.

1 Like