Skip to content

Commit 0c9ce58

Browse files
win5923rueian
andauthored
[Chore] Fix gosec, govet and errcheck lint issues (#4309)
Signed-off-by: win5923 <[email protected]> Signed-off-by: Rueian <[email protected]> Co-authored-by: Rueian <[email protected]>
1 parent ce1d9e9 commit 0c9ce58

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

.golangci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ linters:
1414
- unparam
1515
- unused
1616
- wastedassign
17+
- gosec
18+
- govet
19+
- errcheck
1720
- testifylint
1821
# TODO: The following linters are disabled for now to unblock the golangci-lint v2 migration.
1922
# We will fix the lint errors and re-enable these linters in follow-up PRs.
2023
# - noctx
21-
# - gosec
22-
# - govet
23-
# - errcheck
2424
# - errorlint
2525
# - revive
2626
# - staticcheck

experimental/cmd/main.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,14 @@ func main() {
108108
token := httpproxy.NewTokenAuth(security_token, proxy, secure_prefix, remote)
109109
// Create handler
110110
http.HandleFunc("/", token.AuthFunc())
111-
// Run HTTP proxy
112-
err = http.ListenAndServe(":"+http_local_port, nil)
111+
// Run HTTP proxy with timeouts
112+
server := &http.Server{
113+
Addr: ":" + http_local_port,
114+
ReadTimeout: 0, // No timeout
115+
WriteTimeout: 0, // No timeout
116+
IdleTimeout: 0, // No timeout
117+
}
118+
err = server.ListenAndServe()
113119
if err != nil {
114120
klog.Fatal("HTTP server died unexpectedly, error - ", err)
115121
}

experimental/pkg/httpproxy/support.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212

1313
type authorization struct {
1414
proxy *httputil.ReverseProxy
15-
prefix string
1615
upstream *url.URL
16+
prefix string
1717
}
1818

1919
// Create Unauthorized response

0 commit comments

Comments
 (0)