fix: resolve noinlineerr lint issues
This commit is contained in:
@@ -553,7 +553,8 @@ func (s *Database) connect(ctx context.Context) error {
|
||||
s.log.Info("database connected")
|
||||
|
||||
// Item 9: Enable foreign keys on every connection
|
||||
if _, err := s.db.ExecContext(ctx, "PRAGMA foreign_keys = ON"); err != nil {
|
||||
_, err = s.db.ExecContext(ctx, "PRAGMA foreign_keys = ON")
|
||||
if err != nil {
|
||||
return fmt.Errorf("enable foreign keys: %w", err)
|
||||
}
|
||||
|
||||
@@ -709,7 +710,8 @@ func (s *Database) applyMigrations(
|
||||
)
|
||||
}
|
||||
|
||||
if err := tx.Commit(); err != nil {
|
||||
err = tx.Commit()
|
||||
if err != nil {
|
||||
return fmt.Errorf(
|
||||
"commit migration %d: %w", m.version, err,
|
||||
)
|
||||
|
||||
@@ -62,7 +62,8 @@ func (s *Handlers) HandleCreateSession() http.HandlerFunc {
|
||||
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req request
|
||||
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
err := json.NewDecoder(r.Body).Decode(&req)
|
||||
if err != nil {
|
||||
s.respondJSON(w, r, map[string]string{"error": "invalid request"}, http.StatusBadRequest)
|
||||
|
||||
return
|
||||
@@ -359,7 +360,8 @@ func (s *Handlers) handleJoin(w http.ResponseWriter, r *http.Request, uid, to st
|
||||
return
|
||||
}
|
||||
|
||||
if err := s.params.Database.JoinChannel(r.Context(), chID, uid); err != nil {
|
||||
err = s.params.Database.JoinChannel(r.Context(), chID, uid)
|
||||
if err != nil {
|
||||
s.log.Error("join channel failed", "error", err)
|
||||
s.respondJSON(w, r, map[string]string{"error": "internal error"}, http.StatusInternalServerError)
|
||||
|
||||
@@ -391,7 +393,8 @@ func (s *Handlers) handlePart(w http.ResponseWriter, r *http.Request, uid, to st
|
||||
return
|
||||
}
|
||||
|
||||
if err := s.params.Database.PartChannel(r.Context(), chID, uid); err != nil {
|
||||
err = s.params.Database.PartChannel(r.Context(), chID, uid)
|
||||
if err != nil {
|
||||
s.log.Error("part channel failed", "error", err)
|
||||
s.respondJSON(w, r, map[string]string{"error": "internal error"}, http.StatusInternalServerError)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user