You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by lo...@apache.org on 2022/06/14 16:56:08 UTC
[beam] branch master updated: [#21853] Adjust Go cross-compile to target entire package (#21854)
This is an automated email from the ASF dual-hosted git repository.
lostluck pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new b527ac4bcac [#21853] Adjust Go cross-compile to target entire package (#21854)
b527ac4bcac is described below
commit b527ac4bcac341119e9a3f05c2352b4063fb686e
Author: Daniel Oliveira <da...@gmail.com>
AuthorDate: Tue Jun 14 09:56:01 2022 -0700
[#21853] Adjust Go cross-compile to target entire package (#21854)
This logic was already being applied in the test case but not the general case. Now it is just applied regardless. Instead of targeting a specific main.go file (ex. "foo/main.go") it will now target an entire directory (ex. "foo/.") and get all the other files needed.
---
sdks/go/pkg/beam/runners/universal/runnerlib/compile.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sdks/go/pkg/beam/runners/universal/runnerlib/compile.go b/sdks/go/pkg/beam/runners/universal/runnerlib/compile.go
index a83e3653f12..219f44b1335 100644
--- a/sdks/go/pkg/beam/runners/universal/runnerlib/compile.go
+++ b/sdks/go/pkg/beam/runners/universal/runnerlib/compile.go
@@ -79,10 +79,10 @@ func BuildWorkerBinary(ctx context.Context, filename string) error {
log.Infof(ctx, "Cross-compiling %v as %v", program, filename)
// Cross-compile given go program. Not awesome.
+ program = program[:strings.LastIndex(program, "/")+1]
+ program = program + "."
var build []string
if isTest {
- program = program[:strings.LastIndex(program, "/")+1]
- program = program + "."
build = []string{"go", "test", "-c", "-o", filename, program}
} else {
build = []string{"go", "build", "-o", filename, program}