Skip to content

Commit 8f4bf16

Browse files
chore: upgrade golangci-lint linting for 2.3.0
1 parent 917639a commit 8f4bf16

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

src/cli/edit.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cli
22

33
import (
4+
"context"
45
"fmt"
56
"os"
67
"os/exec"
@@ -16,12 +17,13 @@ func editFileWithEditor(file string) int {
1617

1718
editor = strings.TrimSpace(editor)
1819
args := strings.Split(editor, " ")
19-
2020
editor = args[0]
2121
args = append(args[1:], file)
2222

23-
cmd := exec.Command(editor, args...)
23+
ctx := context.Background()
24+
cmd := exec.CommandContext(ctx, editor, args...)
2425

26+
cmd.Stdin = os.Stdin
2527
cmd.Stdin = os.Stdin
2628
cmd.Stdout = os.Stdout
2729
cmd.Stderr = os.Stderr

src/runtime/http/connection.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
package http
22

33
import (
4+
"context"
45
"net"
56
"time"
67
)
78

8-
// if we can connect to ohmyposh within 200ms, we are connected
9-
// otherwise, let's consider being offline
9+
// IsConnected checks if we can connect to ohmyposh within 200ms
10+
// If we can connect, we are connected; otherwise, let's consider being offline
1011
func IsConnected() bool {
1112
timeout := 200 * time.Millisecond
12-
_, err := net.DialTimeout("tcp", "ohmyposh.dev:80", timeout)
13-
return err == nil
13+
dialer := &net.Dialer{
14+
Timeout: timeout,
15+
}
16+
17+
ctx := context.Background()
18+
conn, err := dialer.DialContext(ctx, "tcp", "ohmyposh.dev:80")
19+
if err != nil {
20+
return false
21+
}
22+
23+
conn.Close()
24+
return true
1425
}

0 commit comments

Comments
 (0)