| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 
 | package main
 import (
 "context"
 "fmt"
 "hello-temporal/workflow"
 "log"
 
 "github.com/google/uuid"
 "go.temporal.io/sdk/client"
 )
 
 func main() {
 c, err := client.Dial(client.Options{
 HostPort:  "127.0.0.1:7233",
 Namespace: "default",
 })
 if err != nil {
 log.Fatalln("unable to create Temporal client", err)
 }
 defer c.Close()
 
 options := client.StartWorkflowOptions{
 ID:        fmt.Sprintf("workflow_id-%s", uuid.New().String()),
 TaskQueue: "test_task_queue_name",
 }
 workflowRun, err := c.ExecuteWorkflow(
 context.Background(),
 options, workflow.HandleName,
 "Tim")
 if err != nil {
 log.Printf("failed to ExecuteWorkflow err: %s\n", err.Error())
 return
 }
 log.Printf("Workflow Id: %s\n", workflowRun.GetID())
 log.Printf("Run Id: %s\n", workflowRun.GetRunID())
 var res string
 if err := workflowRun.Get(context.Background(), &res); err != nil {
 log.Fatalln("failed to execute Workflow", err)
 }
 log.Printf("result: %s\n", res)
 }
 
 |