func hasChanges(deps []string) bool {
	for _, v := range deps {
		for k := range changedDirs {
			if strings.HasSuffix(v, k) {
				return true
			}
		}
	}
	return false
}
checks to see if any of the deps have the same suffix as anything in the changedDirs
package main
import (
	"bufio"
	"flag"
	"fmt"
	"go/build"
	"log"
	"os"
	"os/exec"
	"path/filepath"
	"sort"
	"strings"
)
func usage() {
	fmt.Println(`Usage: <list of packages via stdin> | tainted
Example:
	go list ./... | tainted
This program takes a list of packages from stdin and returns a list of packages
which have beend tained and need to be rebuilt. A package is tained when one or
more of its dependacies have been modified`)
	fmt.Println()
	flag.PrintDefaults()
}
var (
	packages         map[string]struct{}        
	changedDirs      map[string]struct{}        
	cache            map[string]*build.Package  
	gitDirPtr        *string                    
	commitFromPtr    *string                    
	commitToPtr      *string                    
	includeTestFiles *bool                      
)
func init() {
	cache = make(map[string]*build.Package)
	changedDirs = make(map[string]struct{})
	packages = make(map[string]struct{})
}
func main() {
	gitDirPtr = flag.String("dir", ".", "the git directory to check")
	commitFromPtr = flag.String("from", "HEAD~1", "commit to take changes from")
	commitToPtr = flag.String("to", "HEAD", "commit to take changes to")
	includeTestFiles = flag.Bool("test", false, "include test files")
	flag.Usage = usage
	flag.Parse()
	stat, err := os.Stdin.Stat()
	if err != nil {
		fmt.Printf("failed to read from stdin: %s", err)
		os.Exit(1)
	}
	if (stat.Mode() & os.ModeNamedPipe) == 0 {
		flag.Usage()
		os.Exit(0)
	}
	modified()
	readPackages()
	cwd, err := os.Getwd()
	if err != nil {
		log.Fatal(err)
	}
	output := make(map[string]struct{})
	for k := range packages {
		deps, err := findDeps(k, cwd)
		if err != nil {
			log.Fatal(err)
		}
		if hasChanges(deps) {
			output[k] = struct{}{}
		}
	}
	prettyOutput := make([]string, 0, len(output))
	for k := range output {
		prettyOutput = append(prettyOutput, k)
	}
	if len(prettyOutput) == 0 {
		return
	}
	sort.Strings(prettyOutput)
	fmt.Println(strings.Join(prettyOutput, "\n"))
}