This is an automated email from the ASF dual-hosted git repository.
jason810496 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 43f0cfd4830 Document that Go SDK registration closes at Serve (#73614)
43f0cfd4830 is described below
commit 43f0cfd48306c55f50659611a05daeee25573730
Author: Henry Chen <[email protected]>
AuthorDate: Wed Sep 23 21:34:35 2026 +0800
Document that Go SDK registration closes at Serve (#73614)
Both rules were enforced in code without being written down anywhere a
bundle author reads, so the first sign of either was a panic: one at
startup, one on the task's first run under the supervisor.
---
.../docs/authoring-and-scheduling/language-sdks/go.rst | 11 ++++++++---
go-sdk/README.md | 6 +++++-
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/airflow-core/docs/authoring-and-scheduling/language-sdks/go.rst
b/airflow-core/docs/authoring-and-scheduling/language-sdks/go.rst
index f84803843dc..72ea37bf665 100644
--- a/airflow-core/docs/authoring-and-scheduling/language-sdks/go.rst
+++ b/airflow-core/docs/authoring-and-scheduling/language-sdks/go.rst
@@ -163,9 +163,14 @@ Dag, and the ``task_id`` must match a ``@task.stub``
function in that Dag. Neith
function name, so a handler can be named whatever reads best in Go.
``TaskHandler`` also checks the signature of the function it is given and
panics if the check fails -- for
-instance when the function does not take an ``airflow.Context`` first, or does
not return an ``error``.
-Because ``main`` registers every handler before ``Serve``, a mistake stops the
executable as soon as it
-starts rather than when the task first runs.
+instance when the function does not take an ``airflow.Context`` first, does
not return an ``error``, or
+declares a variadic ``...`` parameter, which no stub argument can fill.
Because ``main`` registers every
+handler before ``Serve``, a mistake stops the executable as soon as it starts
rather than when the task
+first runs.
+
+``Serve`` closes registration: a ``Register`` left below it in ``main`` panics
rather than adding a handler
+to the map the runtime is already answering from, so what a bundle can run
never depends on how far
+``main`` has got.
A package that defines task handlers of its own can export them as a
``[]airflow.Registerable`` for ``main``
to pass on with ``bundle.Register(reports.Handlers()...)``.
diff --git a/go-sdk/README.md b/go-sdk/README.md
index 8b2e7f490f0..14bed678abc 100644
--- a/go-sdk/README.md
+++ b/go-sdk/README.md
@@ -94,7 +94,11 @@ func main() {
`TaskHandler` names the `dag_id` and the `task_id` explicitly; neither is
derived from the Go function
name, so a handler can be called whatever reads best in Go. It checks the
signature of the function and
-panics if the check fails, which stops the executable as it starts rather than
when the task first runs.
+panics if the check fails -- a variadic `...` parameter, which no stub
argument can fill, is one such
+failure -- so the executable stops as it starts rather than when the task
first runs. `Serve` then closes
+registration, so a `Register` left below it in `main` panics instead of
changing what the running bundle
+answers for.
+
A package that defines handlers of its own can export them as a
`[]airflow.Registerable` for `main` to
pass on with `bundle.Register(reports.Handlers()...)`.