summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvan Jegen <s.jegen@gmail.com>2015-10-23 19:38:11 +0200
committerSilvan Jegen <s.jegen@gmail.com>2015-10-27 21:40:57 +0100
commit52f3c395ace14cbac92c3a8a96b5d5a241b844c4 (patch)
tree325046a7c625336afacae298b7d65343a62989a8
parent03f3bf552bc3101bcb443f65ddf0b4f434a233e5 (diff)
Remove keyword global
-rw-r--r--gwic.go11
1 files 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)