Skip to content

Commit

Permalink
Fix signature
Browse files Browse the repository at this point in the history
  • Loading branch information
federicotdn committed Dec 11, 2024
1 parent eadb02d commit 637d641
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ func main() {
// Create an HTTP client configured from env vars.
// If no specific env vars are set, this will return a http client that does not perform any retries.
httpCli := clientFromEnv()

server, err := qphttp.NewServer()
if err != nil {
slog.Error("Cannot create server", "err", err)
os.Exit(1)
}
server := qphttp.NewServer()

if otlpEndpoint, tracingEnabled := os.LookupEnv("QUICKPIZZA_OTLP_ENDPOINT"); tracingEnabled {
ctx, cancel := context.WithCancel(context.Background())
Expand Down Expand Up @@ -141,7 +136,7 @@ func main() {

listen := ":3333"
slog.Info("Starting QuickPizza", "listenAddress", listen)
err = http.ListenAndServe(listen, server)
err := http.ListenAndServe(listen, server)
if err != nil {
slog.Error("Running HTTP server", "err", err)
os.Exit(1)
Expand Down
4 changes: 2 additions & 2 deletions pkg/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ type Server struct {
melody *melody.Melody
}

func NewServer() (*Server, error) {
func NewServer() *Server {
logger := slog.New(logging.NewContextLogger(slog.Default().Handler()))

router := chi.NewRouter()
Expand All @@ -130,7 +130,7 @@ func NewServer() (*Server, error) {
router: router,
melody: melody.New(),
log: logger,
}, nil
}
}

func (s *Server) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit 637d641

Please sign in to comment.