<commit_before>package main

import (
	"flag"
	"fmt"
	"go/build"
	"log"
	"os"
)

func usage(status int) {
	fmt.Printf(`Usage:
	%s [PKG]
where PKG is the name of a Go package (e.g., github.com/cespare/deplist). If no
package name is given, the current directory is used.
`, os.Args[0])
	os.Exit(status)
}

func findDeps(soFar map[string]bool, name string, testImports bool) error {
	cwd, err := os.Getwd()
	if err != nil {
		return err
	}

	pkg, err := build.Import(name, cwd, 0)
	if err != nil {
		return err
	}

	if pkg.Goroot {
		return nil
	}

	soFar[pkg.ImportPath] = true
	imports := pkg.Imports
	if testImports {
		imports = append(imports, pkg.TestImports...)
	}
	for _, imp := range imports {
		if !soFar[imp] {
			if err := findDeps(soFar, imp, testImports); err != nil {
				return err
			}
		}
	}
	return nil
}

func main() {
	testImports := flag.Bool("t", false, "Include test dependencies")
	flag.Parse()

	pkg := "."<commit_msg>Ignore the special package "C"<commit_after>package main

import (
	"flag"
	"fmt"
	"go/build"
	"log"
	"os"
)

func usage(status int) {
	fmt.Printf(`Usage:
	%s [PKG]
where PKG is the name of a Go package (e.g., github.com/cespare/deplist). If no
package name is given, the current directory is used.
`, os.Args[0])
	os.Exit(status)
}

func findDeps(soFar map[string]bool, name string, testImports bool) error {
	cwd, err := os.Getwd()
	if err != nil {
		return err
	}

	if name == "C" {
		return nil
	}
	pkg, err := build.Import(name, cwd, 0)
	if err != nil {
		return err
	}
	if pkg.Goroot {
		return nil
	}

	soFar[pkg.ImportPath] = true
	imports := pkg.Imports
	if testImports {
		imports = append(imports, pkg.TestImports...)
	}
	for _, imp := range imports {
		if !soFar[imp] {
			if err := findDeps(soFar, imp, testImports); err != nil {
				return err
			}
		}
	}
	return nil
}

func main() {
	testImports := flag.Bool("t", false, "Include test dependencies")
	flag.Parse()

	pkg := "."
{'fraction_non_alphanumeric': 0.14891416752843847, 'fraction_numerical': 0.002068252326783868, 'mean_word_length': 3.2809734513274336, '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': '1135729', 'n_tokens_mistral': 813, 'n_tokens_neox': 760, 'n_words': 217}