Skip to content

Commit

Permalink
[#21853] Adjust Go cross-compile to target entire package (#21854)
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 authored Jun 14, 2022
1 parent b91b16f commit b527ac4
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 b527ac4

Please sign in to comment.