-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (25 loc) · 762 Bytes
/
main.go
File metadata and controls
34 lines (25 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"flag"
. "github.com/dpecos/golinks/common"
"github.com/dpecos/golinks/workers"
)
var (
nWorkers int
mdPath string
domain string
onlyFailures bool
)
func main() {
flag.IntVar(&nWorkers, "workers", 10, "Number of workers")
flag.StringVar(&mdPath, "path", ".", "Path with text files to check")
flag.StringVar(&domain, "domain", "", "Domain to use for relative links")
flag.BoolVar(&onlyFailures, "only-ko", false, "Show only failed URLs")
flag.Parse()
linkJobs := make(chan Link, nWorkers)
results := make(chan Link)
wg := workers.Start(nWorkers, linkJobs, results)
wgRes := PrintResults(results, onlyFailures)
CheckLinksInPath(mdPath, domain, linkJobs)
workers.Stop(linkJobs, results, wg, wgRes)
}