Skip to content

Add the Go workflow tutorials - #1398

Open
nelson-parente wants to merge 17 commits into
dapr:masterfrom
nelson-parente:tutorials-go
Open

nelson-parente wants to merge 17 commits into
dapr:masterfrom
nelson-parente:tutorials-go

Conversation

@nelson-parente

@nelson-parente nelson-parente commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

This pull request builds on #1394 and #1396 and contains their commits. Review those two pull requests first. After they merge, the diff of this pull request shows only the Go tutorial changes.

The workflow tutorials exist for Python, .NET and Java. Go had one tutorial, history-propagation. This pull request adds the other ten topics and the challenges-tips snippets in Go. They use the same scenarios, endpoints, ports, app IDs and .http requests as the Python tutorials.

Changes

  • New folders in tutorials/workflow/go/: fundamentals, task-chaining, fan-out-fan-in, external-system-interaction, child-workflows, resiliency-and-compensation, monitor-pattern, workflow-management, versioning, combined-patterns and challenges-tips. They use durabletask-go v0.15.1 and go-sdk v1.16.0, the pins of workflows/go/sdk.
  • versioning keeps the three stages of the Python tutorial as files with Go build tags.
  • validate.sh builds Go tutorials with go build -o /dev/null ./..., so the build writes no binary.
  • The Go index and the language table in tutorials/workflow/README.md list every Go tutorial.
  • validate_tutorials.yaml runs the runnable Go tutorials on SQLite, and Go combined-patterns in the Redis job.

Tests

Each tutorial ran in a clean Ubuntu 24.04 container with Dapr CLI and runtime 1.19.0 and Go 1.26.10:

  • bash tutorials/workflow/validate.sh go <topic>: all ten pass. history-propagation also passes after the validate.sh change.
  • The README commands as written, on Redis: all ten pass. versioning passes in all three stages.
  • gofmt -l and go vet ./... are clean for each module.

🤖 Generated with Claude Code

nelson-parente and others added 16 commits November 9, 2026 12:18
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LWoz3gpTsSSL3KbxrLqcW1
Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
With one main package in an app folder, go build ./... writes a binary
named after the folder, which already exists. Build to /dev/null.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the Python workflow fundamentals tutorial to Go. A basic app registers
a workflow with two activities that run in sequence, and exposes
POST /start/{input} on port 5254 to schedule an instance. It uses
durabletask-go v0.15.1 and go-sdk v1.16.0, with the run files, the .http
file and the README of the Python tutorial.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port of the Python task-chaining tutorial. ChainingWorkflow calls Activity1,
Activity2 and Activity3 in sequence. POST /start on port 5255 starts an
instance with the input "This". App id chaining, Dapr HTTP port 3555.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the Python fan-out/fan-in tutorial to Go. The workflow starts one
GetWordLength activity for each word of the input, waits for all of them
and returns the shortest word. The tutorial follows the layout of the Go
fundamentals tutorial.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rial

Port the external system interaction tutorial to Go. An order workflow
requests an external approval when the total price is above 250 dollars.
It waits up to two minutes for the approval-event with
WaitForExternalEvent. The workflow accepts the event payload as a JSON
object (Dapr HTTP API) or as a JSON string that holds the object (Dapr CLI).

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the Python child workflows tutorial to Go. A parent workflow starts one
child workflow for each item of the input array and waits for all of them.
The child workflow chains two activities. The app uses the Dapr Workflow Go
SDK and net/http, and runs with `dapr run -f .`.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rial

Port the Python resiliency-and-compensation tutorial to Go. The workflow
calls an activity with a retry policy, runs a compensating activity when
the activity fails, and sets a custom status.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the monitor pattern tutorial to Go with the durabletask-go workflow
package. The workflow calls an activity, waits on a durable timer when the
resource is not ready, and continues as a new instance with a higher counter.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the Python versioning tutorial to Go. A NotifyUser workflow sends an
email, then an SMS. Three stages: the original workflow, named versions
(AddVersionedWorkflow) and patching (WorkflowContext.IsPatched). The stage
is selected with a Go build tag in the command field of dapr.yaml.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the Python challenges-tips snippets (deterministic workflows, idempotent
activities, payload size) to Go with durabletask-go v0.15.1. The module
compiles with go vet and has no run.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the combined-patterns workflow tutorial to Go. Two apps (workflowapp
and shippingapp) run an order workflow that combines fan-out/fan-in, task
chaining, an external event and compensation. The activities use the Dapr
state, service invocation and pub/sub APIs with Redis. The tutorial has no
SQLite run file because no SQLite pub/sub component exists.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the workflow-management tutorial to Go. HTTP endpoints use the
workflow client of durabletask-go v0.15.1 and go-sdk v1.16.0 to schedule,
query, suspend, resume, terminate and purge a workflow instance. The
README describes the run with Redis and the run without Docker.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e index

The Go tutorial index lists the eleven Go tutorials. The tutorial matrix
runs each runnable Go tutorial, and the combined-patterns job runs the Go
version with the Redis service.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The language table in the workflow tutorials README listed only history
propagation for Go. It now lists the same topics as Python.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- monitor-pattern: POST /start/{counter} now rejects a negative counter
  with 400. Before, the workflow started, and CheckStatus called
  rand.IntN(0), which panics.
- workflow-management: GET /status/{instance_id} now returns 404 when no
  workflow instance has that ID (api.ErrInstanceNotFound). Before, it
  returned 500. The C# tutorial also returns 404 for this case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
@nelson-parente
nelson-parente marked this pull request as ready for review November 9, 2026 13:04
@nelson-parente
nelson-parente requested review from a team as code owners November 9, 2026 13:04
Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>

@alicejgibbons alicejgibbons left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants