Skip to content

Commit f02350b

Browse files
Add Go task explanation (#56)
1 parent 25ca682 commit f02350b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

workflows/concepts/tasks.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ func (t *MyFirstTask) Execute(ctx context.Context) error {
3030
```
3131
</CodeGroup>
3232

33-
This example demonstrates a simple task that prints "Hello World!" to the console. The key components of this task are:
33+
This example demonstrates a simple task that prints "Hello World!" to the console.
34+
35+
For python, the key components of this task are:
3436

3537
<AccordionGroup>
3638
<Accordion title="class MyFirstTask(Task)">
@@ -44,6 +46,17 @@ This example demonstrates a simple task that prints "Hello World!" to the consol
4446
</Accordion>
4547
</AccordionGroup>
4648

49+
For Go, the key components are:
50+
51+
<AccordionGroup>
52+
<Accordion title="type MyFirstTask struct{}">
53+
`MyFirstTask` is a struct that implements the `Task` interface. It represents the task to be executed.
54+
</Accordion>
55+
<Accordion title="func (t *MyFirstTask) Execute(ctx context.Context) error">
56+
The `Execute` method is the entry point for executing the task. This is where the task's logic is defined. It's invoked by a [task runner](/workflows/concepts/task-runners) when the task runs and performs the task's operation.
57+
</Accordion>
58+
</AccordionGroup>
59+
4760
<Note>
4861
The code samples on this page do not illustrate how to execute the task. That will be covered in the
4962
[next section on task runners](/workflows/concepts/task-runners). The reason for that is that executing tasks is a separate concern from implementing tasks.

0 commit comments

Comments
 (0)