fix: linter issue
megacheck, gosimple and unused has been deprecated and subsumed by staticcheck. And staticcheck also has been upgraded. we need to update code for the linter issue. close: #2945 Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
@@ -76,9 +76,9 @@ func serveListener(path string) (net.Listener, error) {
|
||||
|
||||
func handleSignals(logger *logrus.Entry, signals chan os.Signal) error {
|
||||
logger.Info("starting signal loop")
|
||||
|
||||
for {
|
||||
select {
|
||||
case s := <-signals:
|
||||
for s := range signals {
|
||||
switch s {
|
||||
case unix.SIGCHLD:
|
||||
if err := Reap(); err != nil {
|
||||
|
||||
@@ -108,12 +108,11 @@ func serveListener(path string) (net.Listener, error) {
|
||||
|
||||
func handleSignals(logger *logrus.Entry, signals chan os.Signal) error {
|
||||
logger.Info("starting signal loop")
|
||||
|
||||
for {
|
||||
select {
|
||||
case s := <-signals:
|
||||
for s := range signals {
|
||||
switch s {
|
||||
case os.Interrupt:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ func AnonDialer(address string, timeout time.Duration) (net.Conn, error) {
|
||||
timedOutError := errors.Errorf("timed out waiting for npipe %s", address)
|
||||
start := time.Now()
|
||||
for {
|
||||
remaining := timeout - time.Now().Sub(start)
|
||||
remaining := timeout - time.Since(start)
|
||||
if remaining <= 0 {
|
||||
lastError = timedOutError
|
||||
break
|
||||
@@ -71,7 +71,7 @@ func AnonDialer(address string, timeout time.Duration) (net.Conn, error) {
|
||||
// serve it within 5 seconds. We use the passed in timeout for the
|
||||
// `DialPipe` timeout if the pipe exists however to give the pipe time
|
||||
// to `Accept` the connection.
|
||||
if time.Now().Sub(start) >= 5*time.Second {
|
||||
if time.Since(start) >= 5*time.Second {
|
||||
lastError = timedOutError
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user