Skip to content

Commit 702857f

Browse files
committed
Fix govet (unreachable wg)
1 parent e4fdb9d commit 702857f

3 files changed

Lines changed: 3 additions & 11 deletions

File tree

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ version: "2"
22
linters:
33
default: none
44
enable:
5+
- govet
56
- ineffassign
67
- unused
78
- staticcheck

rocketpool/watchtower/watchtower.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"math/rand"
88
"net/http"
99
"os"
10-
"sync"
1110
"time"
1211

1312
"github.com/ethereum/go-ethereum/accounts/abi/bind"
@@ -184,11 +183,7 @@ func run(c *cli.Command) error {
184183
intervalDelta := maxTasksInterval - minTasksInterval
185184
secondsDelta := intervalDelta.Seconds()
186185

187-
// Wait group to handle the various threads
188-
wg := new(sync.WaitGroup)
189-
wg.Add(2)
190-
191-
// Run task loop
186+
// Run task loop forever
192187
go func() {
193188
for {
194189
// Randomize the next interval
@@ -336,7 +331,6 @@ func run(c *cli.Command) error {
336331

337332
time.Sleep(interval)
338333
}
339-
wg.Done()
340334
}()
341335

342336
// Run metrics loop
@@ -345,11 +339,8 @@ func run(c *cli.Command) error {
345339
if err != nil {
346340
errorLog.Println(err)
347341
}
348-
wg.Done()
349342
}()
350343

351-
// Wait for both threads to stop
352-
wg.Wait()
353344
return nil
354345
}
355346

shared/services/connectivity/check-port-connectivity.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func getPublicIP() (string, error) {
178178
// isPortReachableNATReflection attempts a TCP connection to host:port and returns true if
179179
// the connection succeeds within portCheckTimeout.
180180
func isPortReachableNATReflection(host string, port uint16) bool {
181-
address := fmt.Sprintf("%s:%d", host, port)
181+
address := net.JoinHostPort(host, strconv.FormatUint(uint64(port), 10))
182182
conn, err := net.DialTimeout("tcp", address, portCheckTimeout)
183183
if err != nil {
184184
return false

0 commit comments

Comments
 (0)