Skip to content

Commit

Permalink
Linter errors
Browse files Browse the repository at this point in the history
Signed-off-by: Nghia Tran <[email protected]>
  • Loading branch information
tcnghia committed Dec 22, 2023
1 parent 1fddd0a commit 4a433a4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions otel-collector/cmd/otel-collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ func main() {
log.Fatalf("error checking config.yaml: %v", err)
}

log.Printf("config.yaml found at %s", configPath)

ctx, cancel := context.WithCancel(context.Background())

// run /otel-collector binary with --config config.yaml
Expand All @@ -38,11 +36,16 @@ func main() {
mux := http.NewServeMux()
srv := &http.Server{Addr: ":31415", Handler: mux}

Check failure on line 37 in otel-collector/cmd/otel-collector/main.go

View workflow job for this annotation

GitHub Actions / golangci-lint

G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec)
mux.HandleFunc("/quitquitquit", func(w http.ResponseWriter, r *http.Request) {
go srv.Shutdown(ctx)
cancel()
if err := srv.Shutdown(context.Background()); err != nil {
log.Fatalf("failed to shutdown: %v", err)
}
})
go srv.ListenAndServe()

go func() {
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
log.Fatal(err)
}
}()
if err := cmd.Wait(); err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 4a433a4

Please sign in to comment.