File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import (
1414 "github.com/PuerkitoBio/goquery"
1515)
1616
17- const version = `1.0.0 `
17+ const version = `1.0.1 `
1818
1919type SubJS struct {
2020 client * http.Client
@@ -41,6 +41,7 @@ func (s *SubJS) Run() error {
4141 if err != nil {
4242 return fmt .Errorf ("Could not open input file: %s" , err )
4343 }
44+ defer input .Close ()
4445 }
4546
4647 // init channels
@@ -60,10 +61,10 @@ func (s *SubJS) Run() error {
6061 var out sync.WaitGroup
6162 out .Add (1 )
6263 go func () {
63- defer out .Done ()
6464 for result := range results {
6565 fmt .Println (result )
6666 }
67+ out .Done ()
6768 }()
6869 scan := bufio .NewScanner (input )
6970 for scan .Scan () {
@@ -75,6 +76,7 @@ func (s *SubJS) Run() error {
7576 close (urls )
7677 w .Wait ()
7778 close (results )
79+ out .Wait ()
7880 return nil
7981}
8082func (s * SubJS ) fetch (urls <- chan string , results chan string ) {
You can’t perform that action at this time.
0 commit comments