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 2022/04/04 17:08:09 UTC

[GitHub] [beam] lostluck commented on a diff in pull request #17256: [BEAM-5436] Add doc page on Go cross compilation.

lostluck commented on code in PR #17256:
URL: https://github.com/apache/beam/pull/17256#discussion_r841964678


##########
website/www/site/content/en/documentation/sdks/go-cross-compilation.md:
##########
@@ -0,0 +1,76 @@
+---
+type: languages
+title: "Go SDK Cross Compilation"
+---
+<!--
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+# Overview
+
+This page contains technical details for users starting Go SDK pipelines on machines that are not using a `linux` operating system, nor an `amd64` architecture.
+
+Go is a statically compiled language.
+To execute a Go binary on a machine, it must be compiled for the matching operating system and processor architecture.
+This has implications for how Go SDK pipelines execute on [workers](/documentation/glossary/#worker).
+
+# Development: using `go run`
+
+When starting your in development pipeline against a remote runner, you can use `go run` from your development environment.
+Tthe Go SDK will cross-compile your pipeline for `linux-amd64`, and use that as the pipeline's worker binary.
+
+Alternatively, some local runners support Loopback execution.
+Setting the flag `--environment_type=LOOPBACK` can cause the runner to connect back to the local binary to serve as a worker.
+This can simplify development and debugging, by avoiding hiding log output in a container.
+
+# Production: overriding the worker binary
+
+Go SDK pipeline binaries have a `--worker_binary` flag to set the path to the desired worker binary.
+This section will teach you how to use this flag for robust Go pipelines.
+
+In production settings, it's common to only have access to compiled artifacts.
+For Go SDK pipelines, you may need to have two: one for the launching platform, and one for the worker platform.
+
+In order to run a Go program on a specific platform, that program must be built targeting that platform's operating system, and architecture.
+The Go compiler is quick, and able to cross compile to many target architures, by setting the [`$GOOS` and `$GOARCH` environment variables](https://go.dev/doc/install/source#environment) for your build.

Review Comment:
   They're separate clauses. Changing to `quickly` and removing the conjunction makes it read as though it can compile to multiple architectures simultaneously, which isn't the case (to my awareness).
   
   I think dropping the `quick` bit, and the `many` bit resolves the conciseness and clarity though.
   
   `The Go compiler able to cross compile to a target architecture by setting the`...



-- 
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