From 52f3c395ace14cbac92c3a8a96b5d5a241b844c4 Mon Sep 17 00:00:00 2001 From: Silvan Jegen Date: Fri, 23 Oct 2015 19:38:11 +0200 Subject: Remove keyword global --- gwic.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/gwic.go b/gwic.go index a01ac45..c14a431 100644 --- a/gwic.go +++ b/gwic.go @@ -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) -- cgit v1.2.3