Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions pkg/functions/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ func runGo(ctx context.Context, job *Job) (err error) {
fmt.Printf("cd %v && go build -o f.bin\n", job.Dir())
}

// Build
args := []string{"build", "-o", "f.bin"}
args := []string{"mod", "tidy"}
if job.verbose {
args = append(args, "-v")
}
Expand All @@ -124,6 +123,20 @@ func runGo(ctx context.Context, job *Job) (err error) {
return
}

// Build
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff is little bit confusing here, the code below is actually not added code, but the old code.
The code above that looks unchanged is the actual addition here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

difftastic IS AWESOME!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot from 2025-05-28 15-07-56

args = []string{"build", "-o", "f.bin"}
if job.verbose {
args = append(args, "-v")
}
cmd = exec.CommandContext(ctx, "go", args...)
cmd.Dir = job.Dir()
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()
if err != nil {
return
}

// Run
// ---
bin := filepath.Join(job.Dir(), "f.bin")
Expand Down
12 changes: 11 additions & 1 deletion pkg/oci/go_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,18 @@ func goBuild(cfg buildJob, p v1.Platform) (binPath string, err error) {
fmt.Printf(" %v\n", filepath.Base(outpath))
}

cmd := exec.CommandContext(cfg.ctx, gobin, "mod", "tidy")
cmd.Env = envs
cmd.Dir = cfg.buildDir()
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
err = cmd.Run()
if err != nil {
return "", fmt.Errorf("cannot sync deps: %w", err)
}

// Build the function
cmd := exec.CommandContext(cfg.ctx, gobin, args...)
cmd = exec.CommandContext(cfg.ctx, gobin, args...)
cmd.Env = envs
cmd.Dir = cfg.buildDir()
cmd.Stderr = os.Stderr
Expand Down
Loading