chore: fix lint error
Kim committed
Apr 27, 2026 at 11:55 UTC
551a4e3fdc3a6fc2f387e2aac8a5e2433484ea82
1 file changed
+13
-3
cmd/portal-tunnel/installer/update.go
+13
-3
@@ -1,6 +1,7 @@
1
package installer
2
3
import (
4
+ "context"
5
"crypto/sha256"
6
"encoding/hex"
7
"fmt"
@@ -33,7 +34,7 @@ func StartUpdateCheck(currentVersion string) {
34
},
35
}
36
36
- req, err := http.NewRequest(http.MethodHead, binURL, nil)
37
+ req, err := http.NewRequestWithContext(context.Background(), http.MethodHead, binURL, nil)
38
if err == nil {
39
resp, err := client.Do(req)
40
if err == nil {
@@ -80,7 +81,12 @@ func UpdateCurrentBinary(version string) error {
81
82
client := &http.Client{Timeout: 120 * time.Second}
83
83
- resp, err := client.Get(binURL)
84
+ req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, binURL, nil)
85
+ if err != nil {
86
+ _ = tmpFile.Close()
87
+ return fmt.Errorf("failed to build binary request: %w", err)
88
+ }
89
+ resp, err := client.Do(req)
90
if err != nil {
91
_ = tmpFile.Close()
92
return fmt.Errorf("failed to download binary: %w", err)
@@ -105,7 +111,11 @@ func UpdateCurrentBinary(version string) error {
111
return fmt.Errorf("failed to close downloaded binary: %w", err)
112
}
113
108
- resp, err = client.Get(checksumURL)
114
+ req, err = http.NewRequestWithContext(context.Background(), http.MethodGet, checksumURL, nil)
115
+ if err != nil {
116
+ return fmt.Errorf("failed to build checksum request: %w", err)
117
+ }
118
+ resp, err = client.Do(req)
119
if err != nil {
120
return fmt.Errorf("failed to download checksum: %w", err)
121
}