From 3fd397f8795e9fe267eb869aae165990a087fee8 Mon Sep 17 00:00:00 2001 From: Jeremy Edwards <1312331+jeremyje@users.noreply.github.com> Date: Mon, 7 Oct 2024 07:18:27 -0700 Subject: [PATCH] Fix linter errors in Go SDK BUILD.md and README.md files (#32658) --- sdks/go/BUILD.md | 11 ++++++++--- sdks/go/README.md | 27 +++++++++++++-------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/sdks/go/BUILD.md b/sdks/go/BUILD.md index 9834c8ddee89..e2606f3597ee 100644 --- a/sdks/go/BUILD.md +++ b/sdks/go/BUILD.md @@ -62,9 +62,11 @@ To develop the SDK, it should be sufficient to clone the repository, make changes and execute tests from within the module directory (`/sdks/...`). Go users can just `go get` the code directly. For example: -``` + +```bash go get github.com/apache/beam/sdks/v2/go/pkg/beam ``` + Developers must invoke Go for cross-compilation manually, if desired. If you make changes to .proto files, you will need to rebuild the generated code. @@ -72,10 +74,13 @@ Consult `pkg/beam/model/PROTOBUF.md`. If you make changes to .tmpl files, then add the specialize tool to your path. You can install specialize using: -``` + +```bash go get github.com/apache/beam/sdks/v2/go/cmd/specialize ``` + Add it to your path: -``` + +```bash export PATH=$PATH:$GOROOT/bin:$GOPATH/bin ``` diff --git a/sdks/go/README.md b/sdks/go/README.md index 7734d58d9eb9..bcfba2742590 100644 --- a/sdks/go/README.md +++ b/sdks/go/README.md @@ -33,7 +33,7 @@ The examples are normal Go programs and are most easily run directly. They are parameterized by Go flags. For example, to run wordcount on the Go direct runner do: -``` +```bash $ pwd [...]/sdks/go $ go run examples/wordcount/wordcount.go --output=/tmp/result.txt @@ -70,7 +70,7 @@ Edges: 1: Impulse [] -> [Out: []uint8 -> {1: []uint8/GW/bytes}] The debugging output is currently quite verbose and likely to change. The output is a local file in this case: -``` +```bash $ head /tmp/result.txt while: 2 darkling: 1 @@ -86,13 +86,13 @@ purse: 6 To run wordcount on dataflow runner do: -``` -$ go run wordcount.go --runner=dataflow --project= --region= --staging_location=/staging --worker_harness_container_image= --output=/output +```bash +$ go run wordcount.go --runner=dataflow --project= --region= --staging_location=/staging --worker_harness_container_image= --output=/output ``` The output is a GCS file in this case: -``` +```bash $ gsutil cat /output* | head Blanket: 1 blot: 1 @@ -106,7 +106,6 @@ sport: 3 Crown'd: 1 ``` - See [BUILD.md](./BUILD.md) for how to build Go code in general. See [container documentation](https://beam.apache.org/documentation/runtime/environments/#building-container-images) for how to build and push the Go SDK harness container image. @@ -117,9 +116,10 @@ Please use the [`sdk-go`](https://github.com/apache/beam/issues?q=is%3Aopen+is%3 ## Contributing to the Go SDK ### New to developing Go? -https://tour.golang.org : The Go Tour gives you the basics of the language, interactively no installation required. -https://github.com/campoy/go-tooling-workshop is a great start on learning good (optional) development tools for Go. + : The Go Tour gives you the basics of the language, interactively no installation required. + + is a great start on learning good (optional) development tools for Go. ### Developing Go Beam SDK on Github @@ -130,11 +130,10 @@ Executing all unit tests for the SDK is possible from the `\sdks\go` To test your change as Jenkins would execute it from a PR, from the beam root directory, run: - * `./gradlew :sdks:go:goTest` executes the unit tests. - * `./gradlew :sdks:go:test:prismValidatesRunner` validates the SDK against the Go Prism runner as a stand alone binary, with containers. - * `./gradlew :sdks:go:test:ulrValidatesRunner` validates the SDK against the Portable Python runner. - * `./gradlew :sdks:go:test:flinkValidatesRunner` validates the SDK against the Flink runner. - -Follow the [contribution guide](https://beam.apache.org/contribute/contribution-guide/#code) to create branches, and submit pull requests as normal. +* `./gradlew :sdks:go:goTest` executes the unit tests. +* `./gradlew :sdks:go:test:prismValidatesRunner` validates the SDK against the Go Prism runner as a stand alone binary, with containers. +* `./gradlew :sdks:go:test:ulrValidatesRunner` validates the SDK against the Portable Python runner. +* `./gradlew :sdks:go:test:flinkValidatesRunner` validates the SDK against the Flink runner. +Follow the [contribution guide](https://beam.apache.org/contribute/contribution-guide/#code) to create branches, and submit pull requests as normal.