deno.land / x / masx200_leetcode_test@10.6.5 / main.go

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package main
import ( "fmt" "io/fs" "os" "os/exec" "path" "runtime")
func handle(in chan string, out chan any, lim chan struct{}) { lim <- struct{}{} d := <-in run(d, out) <-lim}func main() {
var matches, err = (fs.Glob(os.DirFS("./"), "./*/go.mod")) if err != nil { fmt.Println(err) return } var MAXREQS = runtime.NumCPU()
var lim = make(chan struct{}, MAXREQS) out := make(chan any, len(matches)) in := make(chan string, len(matches)) for range matches {
go handle(in, out, lim)
} for _, m := range matches {
in <- m }
for range matches { var b = <-out if nil != b { panic(b) } }
}func run(m string, out chan any) { defer func() { var e = recover() if e != nil {
out <- e return } out <- nil }()
cmd := exec.Command("go", "test", "-v")
cmd.Dir = "./" + path.Dir(m) fmt.Println(cmd.Dir, cmd) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr var err = cmd.Run() if err != nil { panic(err) }}
masx200_leetcode_test
leetcode测试
DocumentationDocumentation
GitHub Repositorymasx200/leetcode-test
GitHub Stars
4

Version Info

Tagged at
2 months ago