Skip to content

Commit

Permalink
Fix linter errors in Go SDK BUILD.md and README.md files (apache#32658)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyje authored Oct 7, 2024
1 parent 27a669b commit 3fd397f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
11 changes: 8 additions & 3 deletions sdks/go/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,25 @@ To develop the SDK, it should be sufficient to clone the repository, make
changes and execute tests from within the module directory (`<repo>/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.
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
```
27 changes: 13 additions & 14 deletions sdks/go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -86,13 +86,13 @@ purse: 6

To run wordcount on dataflow runner do:

```
$ go run wordcount.go --runner=dataflow --project=<YOUR_GCP_PROJECT> --region=<YOUR_GCP_REGION> --staging_location=<YOUR_GCS_LOCATION>/staging --worker_harness_container_image=<YOUR_SDK_HARNESS_IMAGE_LOCATION> --output=<YOUR_GCS_LOCATION>/output
```bash
$ go run wordcount.go --runner=dataflow --project=<YOUR_GCP_PROJECT> --region=<YOUR_GCP_REGION> --staging_location=<YOUR_GCS_LOCATION>/staging --worker_harness_container_image=<YOUR_SDK_HARNESS_IMAGE_LOCATION> --output=<YOUR_GCS_LOCATION>/output
```

The output is a GCS file in this case:

```
```bash
$ gsutil cat <YOUR_GCS_LOCATION>/output* | head
Blanket: 1
blot: 1
Expand All @@ -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.
Expand All @@ -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.
<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.
### Developing Go Beam SDK on Github
Expand All @@ -130,11 +130,10 @@ Executing all unit tests for the SDK is possible from the `<beam root>\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.

0 comments on commit 3fd397f

Please sign in to comment.