func main()

in make.go [19:56]


func main() {
	outDir := flag.String("output", "bundles", "Output directory for built packages (note the distro name will be appended to this path)")
	buildSpec := flag.String("build-spec", "", "Location of the build spec json file")

	flag.Parse()

	spec, err := readBuildSpec(*buildSpec)
	if err != nil {
		fmt.Fprintln(os.Stderr, "could not read or parse build spec file")
		os.Exit(1)
	}

	ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, unix.SIGTERM)
	defer cancel()

	client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr))
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(2)
	}
	defer client.Close()

	go func() {
		<-ctx.Done()
		client.Close()
	}()

	out, err := do(ctx, client, spec)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(3)
	}

	if _, err := out.Export(ctx, spec.Dir(*outDir)); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(4)
	}
}