in internal/diskutil/utility.go [93:108]
func (d *DiskUtilityCmd) ResizeContainer(ctx context.Context, id string, size string) (string, error) {
// cmdResizeContainer represents the command used for executing macOS's diskutil to resize a container
// * apfs - specifies that a virtual APFS volume is going to be modified
// * resizeContainer - indicates that a container is going to be resized
// * id - the device identifier for the container
// * size - the size which can be in a human-readable format (e.g. "0", "110g", and "1.5t")
cmdResizeContainer := []string{"diskutil", "apfs", "resizeContainer", id, size}
// Execute the diskutil apfs resizeContainer command and store the output
cmdOut, err := util.ExecuteCommand(ctx, cmdResizeContainer, "", nil, nil)
if err != nil {
return cmdOut.Stdout, fmt.Errorf("diskutil: failed to run diskutil command to resize the container, stderr [%s]: %w", cmdOut.Stderr, err)
}
return cmdOut.Stdout, nil
}