Skip to content

Add Go task explanation #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion workflows/concepts/tasks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ func (t *MyFirstTask) Execute(ctx context.Context) error {
```
</CodeGroup>

This example demonstrates a simple task that prints "Hello World!" to the console. The key components of this task are:
This example demonstrates a simple task that prints "Hello World!" to the console.

For python, the key components of this task are:

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

For Go, the key components are:

<AccordionGroup>
<Accordion title="type MyFirstTask struct{}">
`MyFirstTask` is a struct that implements the `Task` interface. It represents the task to be executed.
</Accordion>
<Accordion title="func (t *MyFirstTask) Execute(ctx context.Context) error">
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.
</Accordion>
</AccordionGroup>

<Note>
The code samples on this page do not illustrate how to execute the task. That will be covered in the
[next section on task runners](/workflows/concepts/task-runners). The reason for that is that executing tasks is a separate concern from implementing tasks.
Expand Down