<commit_before>package main

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

var (
	testImports = flag.Bool("t", false, "Include test dependencies")
	prefix      = flag.String("p", "", "Include only packages which match this prefix.")
	include     = flag.Bool("include_input_pkg", false, "Include the package, which was given on the command line, as well.")
	oneline     = flag.Bool("oneline", false, "List all packages as comma-separated list on one line.")

	ignored = map[string]bool{
		"C": true,
	}
)

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...)
		testImports = false
	}
	for _, imp := range imports {
		if soFar[imp] {
			continue
		}
		if _, ok := ignored[imp]; ok {
			continue
		}<commit_msg>Show optional flags in usage output.<commit_after>package main

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

var (
	testImports = flag.Bool("t", false, "Include test dependencies")
	prefix      = flag.String("p", "", "Include only packages which match this prefix.")
	include     = flag.Bool("include_input_pkg", false, "Include PKG in output.")
	oneline     = flag.Bool("oneline", false, "List all packages as comma-separated list on one line.")

	ignored = map[string]bool{
		"C": true,
	}
)

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.

Optional Flags:
`, os.Args[0])
	flag.PrintDefaults()
	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...)
		testImports = false
	}
	for _, imp := range imports {
		if soFar[imp] {
			continue
		}
		if _, ok := ignored[imp]; ok {
			continue
		}
{'fraction_non_alphanumeric': 0.13851617995264404, 'fraction_numerical': 0.0015785319652722968, 'mean_word_length': 3.4708994708994707, 'pattern_counts': {'":': 2, '<': 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': '4753257', 'n_tokens_mistral': 975, 'n_tokens_neox': 918, 'n_words': 278}