-
Notifications
You must be signed in to change notification settings - Fork 18
Fix gocritic lint warnings #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,12 +40,14 @@ func main() { | |
|
|
||
| cfg, err := config.Parse(*configPath) | ||
| if err != nil { | ||
| log.Fatal(err) | ||
| log.Println(err) | ||
| return | ||
| } | ||
|
|
||
| sentry, err := setupSentry() | ||
| if err != nil { | ||
| log.Fatal(err) | ||
| log.Println(err) | ||
| return | ||
| } | ||
|
Comment on lines
41
to
51
|
||
|
|
||
| envSettings := config.ProxyEnvSettings{ | ||
|
|
@@ -89,11 +91,13 @@ func main() { | |
|
|
||
| log.Printf("Listening (%s)", *addr) | ||
| if err := server.ListenAndServe(); err != http.ErrServerClosed { | ||
| log.Fatal(err) | ||
| log.Println(err) | ||
| return | ||
| } | ||
|
|
||
| if err := proxy.Close(); err != nil { | ||
| log.Fatal(err) | ||
| log.Println(err) | ||
| return | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bodyString[:10]will panic when the response body is shorter than 10 bytes (including empty/whitespace-only bodies). Guard the slice with a length check (or log the whole string capped safely) before slicing.