<commit_before>// Copyright 2017 The go-darwin Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"log"
	"os"
	"path/filepath"

	"github.com/go-darwin/hdiutil"
)

func main() {
	img := "/Users/zchee/.docker/machine/cache/boot2docker.iso"
	deviceNode, err := hdiutil.Attach(img, hdiutil.AttachMountPoint("./test"), hdiutil.AttachNoVerify, hdiutil.AttachNoAutoFsck)
	if err != nil {
		log.Fatal(err)
	}

	log.Println(hdiutil.RawDeviceNode(deviceNode))
	log.Println(hdiutil.DeviceNumber(deviceNode))

	if err := hdiutil.Detach(deviceNode); err != nil {
		log.Fatal(err)
	}

	if err := hdiutil.Create("test", hdiutil.CreateMegabytes(20), hdiutil.CreateAPFS, hdiutil.CreateSPARSEBUNDLE); err != nil {
		log.Fatal(err)
	}

	if _, err := filepath.Glob("test.*"); err != nil {
		log.Fatal(err)
	}

	defer func() {
		files, _ := filepath.Glob("test.*")
		for _, file := range files {
			os.RemoveAll(file)
		}
	}()
}<commit_msg>cmd/go-hdiutil: fix img to use the self-created HFS+ image<commit_after>// Copyright 2017 The go-darwin Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"log"
	"os"

	"github.com/go-darwin/hdiutil"
)

func main() {
	img := "test.sparsebundle"

	if err := hdiutil.Create("test", hdiutil.CreateMegabytes(20), hdiutil.CreateHFSPlus, hdiutil.CreateSPARSEBUNDLE); err != nil {
		log.Fatal(err)
	}
	if _, err := os.Stat(img); err != nil {
		log.Fatal(err)
	}
	defer os.RemoveAll(img)

	deviceNode, err := hdiutil.Attach(img, hdiutil.AttachMountPoint("./test"), hdiutil.AttachNoVerify, hdiutil.AttachNoAutoFsck)
	if err != nil {
		log.Fatal(err)
	}

	log.Println(hdiutil.RawDeviceNode(deviceNode))
	log.Println(hdiutil.DeviceNumber(deviceNode))

	if err := hdiutil.Detach(deviceNode); err != nil {
		log.Fatal(err)
	}
}
{'fraction_non_alphanumeric': 0.1487942534633145, 'fraction_numerical': 0.006670087224217547, 'mean_word_length': 4.118110236220472, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2093494', 'n_tokens_mistral': 788, 'n_tokens_neox': 744, 'n_words': 162}