damondouglas commented on a change in pull request #15057:
URL: https://github.com/apache/beam/pull/15057#discussion_r658397674
##########
File path: website/www/site/content/en/documentation/programming-guide.md
##########
@@ -675,10 +746,31 @@ the types of the input and output elements. If your
`DoFn` processes incoming
look like this:
{{< /paragraph >}}
+{{< paragraph class="language-go" >}}
+A `DoFn` processes one element at a time from the input `PCollection`. When you
+create a `DoFn` struct, you'll need to provide type parameters that match
+the types of the input and output elements in a ProcessElement method.
+If your `DoFn` processes incoming `string` elements and produces `int` elements
+for the output collection (like our previous example, `ComputeWordLengthFn`),
your dofn could
+look like this:
+{{< /paragraph >}}
+
{{< highlight java >}}
static class ComputeWordLengthFn extends DoFn<String, Integer> { ... }
{{< /highlight >}}
+{{< highlight go >}}
+type ComputeWordLengthFn struct{}
+
+func (fn *ComputeWordLengthFn) ProcessElement(word string, emit func(int)) {
Review comment:
Suggested edit:
```
func (fn *ComputeWordLengthFn) ProcessElement(word string, emit func(int)) {
```
to
```
// ProcessElement computes the length of word and emits the result
// When creating structs as a DoFn, the ProcessElement performs the work of
this step in the pipeline
func (fn *ComputeWordLengthFn) ProcessElement(word string, emit func(int)) {
```
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]