Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion certchk.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,20 @@ func main() {
// actually check
fmt.Printf("%*s | Certificate status\n%s-+-%s\n", width, "Server",
strings.Repeat("-", width), strings.Repeat("-", 80-width-2))

// channel for synchronizing 'done state', buffer the amount of names
done := make(chan bool, len(names))

for _, name := range names {
check(name, width)
go func(name string) {
check(name, width)
done <- true
}(name)
}

// Drain the channel and wait for all goroutines to complete
for i := 0; i < len(names); i++ {
<-done // wait for one task to complete
}
}

Expand Down