In microservice architectures, it is fairly common to have a project that includes different worker types. A Makefile can be used to manage the creation of multiple programs, but the Go toolchain has a great tool that can be used as well, go generate. Here are some examples of how we take advantage of ‘go generate’ at Nuvi:

  • API/Worker – We have an API that allows clients to start/stop long-running jobs, and a worker which accesses the same database to run the jobs.
  • NLP Classifier – We have different processes that share a majority of the same code, but have different quirks depending on if they are classifying sentiment, vulgarity, or subjectivity.

In other words, we have one git repository, but from that code, we want to generate ‘n‘ number of executables.

#golang #programming #tutorial #ci/cd #deployment #go #go generate #toolchain

Using 'Go Generate' To Deploy Multi-Process Apps
1.65 GEEK