How to generate code with Bazel

1 · Evgeny Khabarov · April 13, 2023, midnight
Summary
genrule + cat genrule + Go binary Add a generator dependency Golang uses code generation heavily. Here-and-there developers generate gRPC stubs, parts of source code, documentation, commit messages, etc. Go even has a special //go:generate directive. Bazel moves code generation to the next level. In this post, I’ll show you how to produce and build Go code with Bazel and with generators written in Go. genrule + cat Our process will look like this:...

Discover more dev blogs

diff.blog tracks 3614 developer blogs. Get a personalized feed of posts based on the topics you care about.

Sign up with GitHub or browse the feed →
AUTHOR