You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/07/02 16:01:18 UTC
[GitHub] [beam] jrmccluskey commented on a change in pull request #15057: [BEAM-12513] Update initial sections of BPG for Go
jrmccluskey commented on a change in pull request #15057:
URL: https://github.com/apache/beam/pull/15057#discussion_r663110713
##########
File path: website/www/site/content/en/documentation/programming-guide.md
##########
@@ -716,11 +837,45 @@ static class ComputeWordLengthFn extends DoFn<String, Integer> {
{{< code_sample "sdks/python/apache_beam/examples/snippets/snippets_test.py" model_pardo_pardo >}}
{{< /highlight >}}
-{{< paragraph class="language-java" >}}
+{{< highlight go >}}
+{{< code_sample "sdks/go/examples/snippets/04transforms.go" model_pardo_pardo >}}
+{{< /highlight >}}
+
+{{< paragraph class="language-go" >}}
+Simple DoFns can also be written as functions.
+{{< /paragraph >}}
+
+{{< highlight go >}}
+func ComputeWordLengthFn(word string, emit func(int)) { ... }
+
+func init() {
+ beam.RegisterFunction(ComputeWordLengthFn)
+}
+{{< /highlight >}}
+
+<span class="language-go" >
+
+> **Note:** Wether using a structural `DoFn` type or a functional `DoFn`, they should be registered with
Review comment:
```suggestion
> **Note:** Whether using a structural `DoFn` type or a functional `DoFn`, they should be registered with
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org