report as we find them

this is in prep to make process concurrent
This commit is contained in:
Stephen McQuay 2017-02-09 08:31:37 -08:00
parent 34740782b6
commit 34cdece6ae
No known key found for this signature in database
GPG Key ID: 1ABF428F71BAFC3D

16
main.go
View File

@ -44,7 +44,7 @@ func main() {
} }
} }
execs := map[string][]string{} execs := map[string]bool{}
execNames := []string{} execNames := []string{}
buf := &bytes.Buffer{} buf := &bytes.Buffer{}
for _, name := range files { for _, name := range files {
@ -80,7 +80,7 @@ func main() {
if bytes.Equal(buf.Bytes(), b) { if bytes.Equal(buf.Bytes(), b) {
_, en := filepath.Split(name) _, en := filepath.Split(name)
if _, ok := execs[en]; !ok { if _, ok := execs[en]; !ok {
execs[en] = []string{} execs[en] = true
execNames = append(execNames, en) execNames = append(execNames, en)
} }
} }
@ -108,22 +108,14 @@ func main() {
return nil return nil
} }
_, en := filepath.Split(pkg.ImportPath) _, en := filepath.Split(pkg.ImportPath)
p := filepath.Join(srcDir, pkg.ImportPath)
if _, ok := execs[en]; ok { if _, ok := execs[en]; ok {
execs[en] = append(execs[en], filepath.Join(srcDir, pkg.ImportPath)) fmt.Printf("%-30s%s\n", en, p)
} }
return nil return nil
}, },
) )
} }
for _, name := range execNames {
if len(execs[name]) > 0 {
fmt.Println(name)
for _, potential := range execs[name] {
fmt.Printf("\t%s\n", potential)
}
}
}
} }
// Exists emits true if path exists, false otherwise // Exists emits true if path exists, false otherwise