Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
[apache#21853] Adjust Go cross-compile to target entire package
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
youngoli committed Jun 14, 2022
1 parent 080f54a commit 35b68a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdks/go/pkg/beam/runners/universal/runnerlib/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 35b68a6

Please sign in to comment.