Skip to content

Add Go Standalone Activities quickstart snippets - #311

Merged
Duncanma merged 2 commits into
mainfrom
docs/go-standalone-quickstart
Nov 24, 2026
Merged

Duncanma merged 2 commits into
mainfrom
docs/go-standalone-quickstart

Conversation

@Duncanma

@Duncanma Duncanma commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Lets the Go Standalone Activities quickstart sync its code from go-sandbox/activities/standalone/ instead of hand-typing it. That page is the last Quickstart page with hand-typed SDK code (temporalio/documentation#5105).

  • Wraps activity.go and worker/main.go in whole-file snippets (go-standalone-activity-quickstart-activity, go-standalone-activity-quickstart-worker).
  • Wraps the starter's ExecuteActivity call in go-standalone-activity-quickstart-execute.
  • Adds a -command start-by-name path that starts the Activity by its type name, with the call in go-standalone-activity-quickstart-execute-by-name.
  • Switches the Worker and starter from client.Options{} to envconfig.MustLoadDefaultClientOptions(). The quickstart's "Run with Temporal Cloud" section says every sample on the page uses envconfig, so the same code works against a dev server and Temporal Cloud.

The whole-file snippets put // @@@SNIPEND right after the closing brace, like the other whole-file Go snippets, so gofmt -l lists those two files, as it does the existing ones.

The four snippets the Go feature guide already uses (go-standalone-activity-get-result, -get-handle, -list, -count) are unchanged. Snipsync doesn't nest snippets, so the new markers sit outside them.

Companion docs PR: temporalio/documentation#5803 (draft until this merges).

Local checks

From go-sandbox/:

go build ./...                     # ok
go vet ./...                       # ok
go test ./...                      # all packages ok

End to end against temporal server start-dev (CLI 1.10.1, Server 1.32.2), with TEMPORAL_ADDRESS set:

go run ./activities/standalone/worker
go run ./activities/standalone/starter                         # Activity result: Hello Temporal!
go run ./activities/standalone/starter -command start-by-name  # Activity result: Hello Temporal!
go run ./activities/standalone/starter -command list           # lists the Completed Activities
go run ./activities/standalone/starter -command count          # Total activities: 3
temporal activity execute --type Activity --activity-id cli-quickstart-check \
  --task-queue standalone-activity-helloworld --start-to-close-timeout 10s --input '"Temporal"'

Wrap the Activity and Worker files, the starter's ExecuteActivity call,
and a new start-by-name path in Snipsync markers so the Go quickstart
page can sync them instead of hand-typing the code.

Switch the Worker and starter to envconfig so the same code connects to
a local dev server or Temporal Cloud, as the quickstart page says.
Matches the other whole-file Go snippets, so the synced code blocks
don't end with an empty line.
@Duncanma
Duncanma merged commit 9aa18fb into main Nov 24, 2026
11 checks passed
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.

1 participant