title: “Beam Quickstart for Go”

Apache Beam Go SDK Quickstart

This Quickstart will walk you through executing your first Beam pipeline to run WordCount, written using Beam's Go SDK, on a runner of your choice.

If you're interested in contributing to the Apache Beam Go codebase, see the Contribution Guide.

{{< toc >}}

Set up your environment

The Beam SDK for Go requires go version 1.10 or newer. It can be downloaded here. Check that you have version 1.10 by running:

{{< highlight >}} $ go version {{< /highlight >}}

Get the SDK and the examples

The easiest way to obtain the Apache Beam Go SDK is via go get:

{{< highlight >}} $ go get -u github.com/apache/beam/sdks/go/... {{< /highlight >}}

For development of the Go SDK itself, see BUILD.md for details.

Run wordcount

The Apache Beam examples directory has many examples. All examples can be run by passing the required arguments described in the examples.

For example, to run wordcount, run:

{{< highlight class=“runner-direct” >}} $ go install github.com/apache/beam/sdks/go/examples/wordcount $ wordcount --input <PATH_TO_INPUT_FILE> --output counts {{< /highlight >}}

{{< highlight class=“runner-dataflow” >}} $ go install github.com/apache/beam/sdks/go/examples/wordcount

As part of the initial setup, for non linux users - install package unix before run

$ go get -u golang.org/x/sys/unix $ wordcount --input gs://dataflow-samples/shakespeare/kinglear.txt
--output gs:///counts
--runner dataflow
--project your-gcp-project
--region your-gcp-region
--temp_location gs:///tmp/
--staging_location gs:///binaries/
--worker_harness_container_image=apache/beam_go_sdk:latest {{< /highlight >}}

{{< highlight class=“runner-nemo” >}} This runner is not yet available for the Go SDK. {{< /highlight >}}

Next Steps

Please don't hesitate to reach out if you encounter any issues!