in make.go [76:107]
func do(ctx context.Context, client *dagger.Client, cfg *archive.Spec) (*dagger.Directory, error) {
if cfg.Arch == "" {
p, err := client.DefaultPlatform(ctx)
if err != nil {
return nil, fmt.Errorf("could not determine default platform: %w", err)
}
_, a, ok := strings.Cut(string(p), "/")
if !ok {
return nil, fmt.Errorf("unexpected platform format: %q", p)
}
cfg.Arch = a
}
targetOs := "linux"
if cfg.Distro == "windows" {
targetOs = "windows"
}
platform := dagger.Platform(fmt.Sprintf("%s/%s", targetOs, cfg.Arch))
getGoVersion, ok := targets.GetGoVersionForPackage[cfg.Pkg]
if !ok {
return nil, fmt.Errorf("unknown package: %q", cfg.Pkg)
}
goVersion := getGoVersion(cfg)
target, err := targets.GetTarget(ctx, cfg.Distro, client, platform, goVersion)
if err != nil {
return nil, err
}
return target.Make(cfg, packageDir(client, cfg.Pkg), hackCrossDir(client))
}