---
title: "Go Code Generation with Temporal & Protobufs"
description: "Generates code for Temporal workflows from Protobuf definitions, automating client and worker creation. It simplifies development by converting structured workflow definitions into runnable code, reducing manual effort and ensuring consistency."
canonical: "https://temporal.io/code-exchange/go-code-generation-with-temporal-and-protobufs.md"
source: "https://temporal.io/code-exchange/go-code-generation-with-temporal-and-protobufs"
published: "2025-03-13"
authors:
  - "Chris Ludden"
company: "Temporal"
languages:
  - "Go"
tags:
  - "code generation"
  - "protobuf"
reviewed_by_temporal: false
community_contribution: true
---

# Go Code Generation with Temporal & Protobufs

Generates code for Temporal workflows from Protobuf definitions, automating client and worker creation. It simplifies development by converting structured workflow definitions into runnable code, reducing manual effort and ensuring consistency.

- [View repo](https://github.com/cludden/protoc-gen-go-temporal)
- [View web page](https://cludden.github.io/protoc-gen-go-temporal/)

__protoc-gen-go-temporal__ is a protoc plugin for generating typed Temporal clients and workers in Go from [protobuf](https://protobuf.dev/) schemas. This plugin allows:

- workflow authors to configure sensible defaults and guardrails
- simplifies the implementation and testing of Temporal workers
- and streamlines integration by providing typed client SDKs and a generated CLI application

Here's the "Temporal @ Hashicorp" Replay talk where we announced the plugin and gave a quick introduction to it:

<iframe width="560" height="315" src="https://www.youtube.com/embed/fqKDWZDj-c0?si=-2-hRciJzIIrKjEL" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

### Features

Generated Client with:

- methods for executing workflows, queries, signals, and updates
- methods for cancelling or terminating workflows
- default client.StartWorkflowOptions and client.UpdateWorkflowWithOptionsRequest
- dynamic workflow ids, update ids, and search attributes via [Bloblang expressions](https://cludden.github.io/protoc-gen-go-temporal/#bloblang-expressions)
- default timeouts, id reuse policies, retry policies, wait policies

Generated Worker resources with:

- functions for calling activities and local activities from workflows
- functions for executing child workflows and signalling external workflows
- default workflow.ActivityOptions, workflow.ChildWorkflowOptions
- default timeouts, parent cose policies, retry policies

Optional CLI with:

- commands for executing workflows, synchronously or asynchronously
- commands for starting workflows with signals, synchronously or asynchronously
- commands for querying existing workflows
- commands for sending signals to existing workflows
- typed flags for conventiently specifying workflow, query, and signal inputs

Generated [Cross-Namespace (XNS)](https://cludden.github.io/docs/guides/xns) helpers: [Experimental]

- with support for invoking a service's workflows, queries, signals, and updates from workflows in a different temporal namespace

Generated [Remote Codec Server](https://cludden.github.io/docs/guides/codec-server) helpers

Generated [Markdown Documentation](https://cludden.github.io/docs/guides/documentation)

### Inspiration

This project was inspired by [Chad Retz's](https://github.com/cretz/) awesome [github.com/cretz/temporal-sdk-go-advanced](https://github.com/cretz/temporal-sdk-go-advanced) and [Jacob LeGrone's](https://github.com/jlegrone/) excellent Replay talk on [Temporal @ Datadog](https://youtu.be/LxgkAoTSI8Q?si=ZGwwbfbMz48MkPhj&t=681)
