diff --git a/cmd/tools/sigrepocheck.go b/cmd/tools/sigrepocheck.go index 8b62509689555e562ea03d1a4cb524d38cf8050c..2ee51419eb4a9c306cdd01900072574fe7a79bb7 100644 --- a/cmd/tools/sigrepocheck.go +++ b/cmd/tools/sigrepocheck.go @@ -59,6 +59,7 @@ func buildSigCommand() *cobra.Command { func CheckSigRepo() error { var wg sync.WaitGroup + var endwg sync.WaitGroup var totalProjects []string var scanProjects []string var invalidProjects []string @@ -73,15 +74,19 @@ func CheckSigRepo() error { resultChannel := make(chan string, 50) go func() { + endwg.Add(1) for rs := range resultChannel { totalProjects = append(totalProjects, rs) } + endwg.Done() }() go func() { + endwg.Add(1) for rs := range sigChannel { scanProjects = append(scanProjects, rs) } + endwg.Done() }() // Running 5 workers to collect the projects status @@ -96,11 +101,16 @@ func CheckSigRepo() error { scanner := NewDirScanner("") err := scanner.ScanSigYaml(sigRepoCheck.FileName, sigChannel) + //Wait all gitee query threads to be finished wg.Wait() + //Close the result channels close(resultChannel) + //Wait all result collection threads to be finished + endwg.Wait() if err != nil { return err } + //fmt.Printf("this is the total projects: \n %s", strings.Join(totalProjects, ";")) for _, scan := range scanProjects { if !Find(totalProjects, scan) { diff --git a/validator b/validator new file mode 100755 index 0000000000000000000000000000000000000000..ba8bb25c2d83fd88baa6e0515760b482b5e82c0a Binary files /dev/null and b/validator differ