Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
caioeverest committed Jan 17, 2024
1 parent 7b9a3b4 commit ffdc3e4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
issues:
exclude-rules:
- path: internal/user/handler_oauth.go
text: 'SA1029: should not use built-in type string as key for value; define your own type to avoid collisions'
5 changes: 4 additions & 1 deletion internal/user/handler_oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ func (h *UserHandler) AuthLogout(c echo.Context) (err error) {
ctx = context.WithValue(ctx, "provider", providerRaw)
c.SetRequest(c.Request().WithContext(ctx))

gothic.Logout(res, req)
if err = gothic.Logout(res, req); err != nil {
slog.Error("Fail to execute logout", "error", err.Error())
return
}
res.Header().Set("Location", "/")
res.WriteHeader(http.StatusTemporaryRedirect)
return
Expand Down
7 changes: 6 additions & 1 deletion lib/server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ func NewHTTPServer(lc fx.Lifecycle) *echo.Echo {
lc.Append(fx.Hook{
OnStart: func(_ context.Context) error {
slog.Info(fmt.Sprintf("Starting HTTP server at %d", cfg.HTTPPort))
go srv.Start(fmt.Sprintf(":%d", cfg.HTTPPort))
go func() {
if err := srv.Start(fmt.Sprintf(":%d", cfg.HTTPPort)); err != nil {
slog.Error("Fail to start http server", "error", err)
panic(err)
}
}()
return nil
},
OnStop: srv.Shutdown,
Expand Down

0 comments on commit ffdc3e4

Please sign in to comment.