func Zip(ctx context.Context, opts *Options) error {
	logger := opts.Logger
	if logger == nil {
		logger = hclog.NewNullLogger()
	}
	root, err := createRoot(ctx, logger, opts)
	if err != nil {
		return err
	}
	defer os.RemoveAll(root)
	cmd, err := dittoCmd(ctx, opts.BaseCmd)
	if err != nil {
		return err
	}
	cmd.Args = []string{
		filepath.Base(cmd.Path),
		"-c",  
		"-k",  
	}
	cmd.Args = append(cmd.Args, root)
	cmd.Args = append(cmd.Args, opts.OutputPath)
	var out bytes.Buffer
	cmd.Stdout = &out
	cmd.Stderr = cmd.Stdout
	logger.Info("executing ditto for zip archive creation",
		"output_path", opts.OutputPath,
		"command_path", cmd.Path,
		"command_args", cmd.Args,
	)
	if err = cmd.Run(); err != nil {
		logger.Error("error creating zip archive", "err", err, "output", out.String())
		return err
	}
	logger.Info("zip archive creation complete", "output", out.String())
	return nil
}
Zip creates a zip archive for notarization using the options given.

For now this works by subprocessing to "ditto" which is the recommended
mechanism by the Apple documentation. We could in the future change to
using pure Go but given the requirement of gon to run directly on macOS
machines, we can be sure ditto exists and produces valid output.
package zip
import (
	"bytes"
	"context"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"github.com/hashicorp/go-hclog"
)
type Options struct {
	Files []string
	OutputPath string
	Logger hclog.Logger
	BaseCmd *exec.Cmd
}