mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-09 22:42:58 +00:00
Fix newly found linter issues (#3099)
Fixes the issues found in https://github.com/matrix-org/dendrite/actions/runs/5155539352/jobs/9285342056#step:5:22. Only naked returns in longer functions.
This commit is contained in:
parent
ea6b368ad4
commit
d11da6ec7c
@ -157,7 +157,7 @@ func (r *Peeker) performPeekRoomByID(
|
|||||||
content := map[string]string{}
|
content := map[string]string{}
|
||||||
if err = json.Unmarshal(ev.Content(), &content); err != nil {
|
if err = json.Unmarshal(ev.Content(), &content); err != nil {
|
||||||
util.GetLogger(ctx).WithError(err).Error("json.Unmarshal for history visibility failed")
|
util.GetLogger(ctx).WithError(err).Error("json.Unmarshal for history visibility failed")
|
||||||
return
|
return "", err
|
||||||
}
|
}
|
||||||
if visibility, ok := content["history_visibility"]; ok {
|
if visibility, ok := content["history_visibility"]; ok {
|
||||||
worldReadable = visibility == "world_readable"
|
worldReadable = visibility == "world_readable"
|
||||||
@ -185,7 +185,7 @@ func (r *Peeker) performPeekRoomByID(
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// By this point, if req.RoomIDOrAlias contained an alias, then
|
// By this point, if req.RoomIDOrAlias contained an alias, then
|
||||||
|
@ -314,11 +314,12 @@ func (r *messagesReq) retrieveEvents() (
|
|||||||
clientEvents []synctypes.ClientEvent, start,
|
clientEvents []synctypes.ClientEvent, start,
|
||||||
end types.TopologyToken, err error,
|
end types.TopologyToken, err error,
|
||||||
) {
|
) {
|
||||||
|
emptyToken := types.TopologyToken{}
|
||||||
// Retrieve the events from the local database.
|
// Retrieve the events from the local database.
|
||||||
streamEvents, err := r.snapshot.GetEventsInTopologicalRange(r.ctx, r.from, r.to, r.roomID, r.filter, r.backwardOrdering)
|
streamEvents, err := r.snapshot.GetEventsInTopologicalRange(r.ctx, r.from, r.to, r.roomID, r.filter, r.backwardOrdering)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("GetEventsInRange: %w", err)
|
err = fmt.Errorf("GetEventsInRange: %w", err)
|
||||||
return
|
return []synctypes.ClientEvent{}, emptyToken, emptyToken, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var events []*rstypes.HeaderedEvent
|
var events []*rstypes.HeaderedEvent
|
||||||
@ -333,11 +334,11 @@ func (r *messagesReq) retrieveEvents() (
|
|||||||
// on the ordering), or we've reached a backward extremity.
|
// on the ordering), or we've reached a backward extremity.
|
||||||
if len(streamEvents) == 0 {
|
if len(streamEvents) == 0 {
|
||||||
if events, err = r.handleEmptyEventsSlice(); err != nil {
|
if events, err = r.handleEmptyEventsSlice(); err != nil {
|
||||||
return
|
return []synctypes.ClientEvent{}, emptyToken, emptyToken, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if events, err = r.handleNonEmptyEventsSlice(streamEvents); err != nil {
|
if events, err = r.handleNonEmptyEventsSlice(streamEvents); err != nil {
|
||||||
return
|
return []synctypes.ClientEvent{}, emptyToken, emptyToken, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ func (p *PDUStreamProvider) getJoinResponseForCompleteSync(
|
|||||||
|
|
||||||
stateEvents, err := snapshot.CurrentState(ctx, roomID, stateFilter, excludingEventIDs)
|
stateEvents, err := snapshot.CurrentState(ctx, roomID, stateFilter, excludingEventIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return jr, err
|
||||||
}
|
}
|
||||||
|
|
||||||
jr.Summary, err = snapshot.GetRoomSummary(ctx, roomID, device.UserID)
|
jr.Summary, err = snapshot.GetRoomSummary(ctx, roomID, device.UserID)
|
||||||
@ -542,7 +542,7 @@ func (p *PDUStreamProvider) getJoinResponseForCompleteSync(
|
|||||||
}
|
}
|
||||||
backwardTopologyPos, backwardStreamPos, err = snapshot.PositionInTopology(ctx, event.EventID())
|
backwardTopologyPos, backwardStreamPos, err = snapshot.PositionInTopology(ctx, event.EventID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return jr, err
|
||||||
}
|
}
|
||||||
prevBatch = &types.TopologyToken{
|
prevBatch = &types.TopologyToken{
|
||||||
Depth: backwardTopologyPos,
|
Depth: backwardTopologyPos,
|
||||||
|
@ -644,7 +644,7 @@ func (d *Database) CreateDevice(
|
|||||||
for i := 1; i <= 5; i++ {
|
for i := 1; i <= 5; i++ {
|
||||||
newDeviceID, returnErr = generateDeviceID()
|
newDeviceID, returnErr = generateDeviceID()
|
||||||
if returnErr != nil {
|
if returnErr != nil {
|
||||||
return
|
return nil, returnErr
|
||||||
}
|
}
|
||||||
|
|
||||||
returnErr = d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
|
returnErr = d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
|
||||||
@ -653,7 +653,7 @@ func (d *Database) CreateDevice(
|
|||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
if returnErr == nil {
|
if returnErr == nil {
|
||||||
return
|
return dev, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user