diff options
-rw-r--r-- | gwic.go | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -69,7 +69,7 @@ func feedworkers(wlist []*work, w string) []*work { return ret } -func printqueue(q *queue, words chan string, left int, out chan string) { +func printqueue(q *queue, words chan string, kw string, left int, out chan string) { var hungryhippos []*work for w := range words { @@ -99,16 +99,13 @@ func printqueue(q *queue, words chan string, left int, out chan string) { close(out) } -var ( - tw *tabwriter.Writer - kw string -) +var tw *tabwriter.Writer const MAX int = 11 func main() { flag.Parse() - kw = flag.Arg(0) + kw := flag.Arg(0) if len(kw) == 0 { fmt.Printf("Need string to search for. Exiting...\n") os.Exit(1) @@ -139,7 +136,7 @@ func main() { close(c) }(sc) - go printqueue(&q, sc, 5, out) + go printqueue(&q, sc, kw, 5, out) for l := range out { fmt.Fprintf(tw, "%s\n", l) |