func main(){
...
filesWithMatch += countLines(os.Stdin, counts)
...
}
func countLines(f *os.File, counts map[string]int) string {
input := bufio.NewScanner(f)
for input.Scan() {
counts[input.Text()]++
}
for _, n := range counts {
if n > 1 {
return f.Name()
}
}
return ""
}