Documentation
¶
Overview ¶
Package protogen holds the parts of this repository's protobuf generation that are code rather than magefile: the module protoc-gen-twirp is run out of, and the environment every generator is invoked with.
It exists as a package rather than as magefile code so that the pins it carries are covered by a test. github.com/ttab/mage/rpc does the same thing for every repository that generates through the rpc namespace; this repository cannot use that target, because it lays its protobuf sources out as "<dir>/*.proto" rather than as the "<root>/<service>/service.proto" the target discovers, so the pieces are mirrored here instead.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Env ¶
Env returns the environment overrides every generator invocation runs with. buf passes its own environment on to the plugins it spawns, so setting it on buf is what reaches all of them.
GOTOOLCHAIN pins the compiler, because the toolchain decides some of the bytes a generator writes. GOFLAGS has -mod dropped: the generators are separate modules run out of the module cache rather than out of this one, so a -mod=vendor left in the environment fails every one of them with "cannot query module".
func TwirpGenerator ¶
TwirpGenerator writes the protoc-gen-twirp module into the work directory and returns the command that runs the plugin out of it. The plugins buf spawns take nothing from the directory but the command line, so it only has to outlive the buf run.
Types ¶
This section is empty.