fix wg init
This commit is contained in:
2
main.go
2
main.go
@@ -107,6 +107,7 @@ func main() {
|
|||||||
wg := new(sync.WaitGroup)
|
wg := new(sync.WaitGroup)
|
||||||
|
|
||||||
for _, ip := range strings.Split(*shellyFlag, ",") {
|
for _, ip := range strings.Split(*shellyFlag, ",") {
|
||||||
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
err := checkShelly(ip)
|
err := checkShelly(ip)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -119,7 +120,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkShelly(ip string) error {
|
func checkShelly(ip string) error {
|
||||||
wg.Add(1)
|
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
log.Infof("shelly worker %s started", ip)
|
log.Infof("shelly worker %s started", ip)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user