As the title says, is it possible to generate code (with something like //go:generate
) after a module dependency is downloaded?
Specifically, let's say there's a repo example.com/protobuf
containing some .proto
files and a few .sh
scripts for generating bindings in different languages, plus a go.mod
so it can be used as a dependency from go like so:
module example.com/application
go 1.18
require (
example.com/protobuf v1.0.0
)
However, the generated .go
files are not included in this repo, they have to be generated using one of the .sh
scripts, so if you try this, you get an error like module example.com/protobuf@latest found (v1.0.0), but does not contain package example.com/protobuf/foo
Is there a way around this without resorting to eg. git submodules?