提交 139fae98 编写于 作者: E Erik Johnston 提交者: Richard van der Hoff

Fix linting errors in go1.9.1 (#336)

Fix linting errors in go1.9.1
上级 ff8b2291
...@@ -96,11 +96,7 @@ func (s *OutputRoomEventConsumer) onMessage(msg *sarama.ConsumerMessage) error { ...@@ -96,11 +96,7 @@ func (s *OutputRoomEventConsumer) onMessage(msg *sarama.ConsumerMessage) error {
return err return err
} }
if err := s.db.UpdateMemberships(context.TODO(), events, output.NewRoomEvent.RemovesStateEventIDs); err != nil { return s.db.UpdateMemberships(context.TODO(), events, output.NewRoomEvent.RemovesStateEventIDs)
return err
}
return nil
} }
// lookupStateEvents looks up the state events that are added by a new event. // lookupStateEvents looks up the state events that are added by a new event.
......
...@@ -355,9 +355,5 @@ func emit3PIDInviteEvent( ...@@ -355,9 +355,5 @@ func emit3PIDInviteEvent(
return err return err
} }
if err := producer.SendEvents(ctx, []gomatrixserverlib.Event{*event}, cfg.Matrix.ServerName); err != nil { return producer.SendEvents(ctx, []gomatrixserverlib.Event{*event}, cfg.Matrix.ServerName)
return err
}
return nil
} }
...@@ -113,10 +113,7 @@ func WriteConfig(cfg *config.Dendrite, configDir string) error { ...@@ -113,10 +113,7 @@ func WriteConfig(cfg *config.Dendrite, configDir string) error {
if err != nil { if err != nil {
return err return err
} }
if err = ioutil.WriteFile(filepath.Join(configDir, ConfigFile), data, 0666); err != nil { return ioutil.WriteFile(filepath.Join(configDir, ConfigFile), data, 0666)
return err
}
return nil
} }
// NewMatrixKey generates a new ed25519 matrix server key and writes it to a file. // NewMatrixKey generates a new ed25519 matrix server key and writes it to a file.
......
...@@ -63,11 +63,11 @@ func GetProfile( ...@@ -63,11 +63,11 @@ func GetProfile(
switch field { switch field {
case "displayname": case "displayname":
res = common.DisplayName{ res = common.DisplayName{
profile.DisplayName, DisplayName: profile.DisplayName,
} }
case "avatar_url": case "avatar_url":
res = common.AvatarURL{ res = common.AvatarURL{
profile.AvatarURL, AvatarURL: profile.AvatarURL,
} }
default: default:
code = 400 code = 400
...@@ -75,8 +75,8 @@ func GetProfile( ...@@ -75,8 +75,8 @@ func GetProfile(
} }
} else { } else {
res = common.ProfileResponse{ res = common.ProfileResponse{
profile.AvatarURL, AvatarURL: profile.AvatarURL,
profile.DisplayName, DisplayName: profile.DisplayName,
} }
} }
......
...@@ -170,11 +170,7 @@ func (t *txnReq) processEvent(e gomatrixserverlib.Event) error { ...@@ -170,11 +170,7 @@ func (t *txnReq) processEvent(e gomatrixserverlib.Event) error {
// TODO: Check that the event is allowed by its auth_events. // TODO: Check that the event is allowed by its auth_events.
// pass the event to the roomserver // pass the event to the roomserver
if err := t.producer.SendEvents(t.context, []gomatrixserverlib.Event{e}, api.DoNotSendToOtherServers); err != nil { return t.producer.SendEvents(t.context, []gomatrixserverlib.Event{e}, api.DoNotSendToOtherServers)
return err
}
return nil
} }
func checkAllowedByState(e gomatrixserverlib.Event, stateEvents []gomatrixserverlib.Event) error { func checkAllowedByState(e gomatrixserverlib.Event, stateEvents []gomatrixserverlib.Event) error {
...@@ -218,8 +214,5 @@ func (t *txnReq) processEventWithMissingState(e gomatrixserverlib.Event) error { ...@@ -218,8 +214,5 @@ func (t *txnReq) processEventWithMissingState(e gomatrixserverlib.Event) error {
return err return err
} }
// pass the event along with the state to the roomserver // pass the event along with the state to the roomserver
if err := t.producer.SendEventWithState(t.context, state, e); err != nil { return t.producer.SendEventWithState(t.context, state, e)
return err
}
return nil
} }
...@@ -54,11 +54,7 @@ func (d *Database) prepare() error { ...@@ -54,11 +54,7 @@ func (d *Database) prepare() error {
return err return err
} }
if err = d.PartitionOffsetStatements.Prepare(d.db, "federationsender"); err != nil { return d.PartitionOffsetStatements.Prepare(d.db, "federationsender")
return err
}
return nil
} }
// UpdateRoom updates the joined hosts for a room and returns what the joined // UpdateRoom updates the joined hosts for a room and returns what the joined
......
...@@ -22,7 +22,6 @@ import ( ...@@ -22,7 +22,6 @@ import (
"net/url" "net/url"
"path" "path"
log "github.com/sirupsen/logrus"
"github.com/matrix-org/dendrite/clientapi/jsonerror" "github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/common/config" "github.com/matrix-org/dendrite/common/config"
"github.com/matrix-org/dendrite/mediaapi/fileutils" "github.com/matrix-org/dendrite/mediaapi/fileutils"
...@@ -31,6 +30,7 @@ import ( ...@@ -31,6 +30,7 @@ import (
"github.com/matrix-org/dendrite/mediaapi/types" "github.com/matrix-org/dendrite/mediaapi/types"
"github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util" "github.com/matrix-org/util"
log "github.com/sirupsen/logrus"
) )
// uploadRequest metadata included in or derivable from an upload request // uploadRequest metadata included in or derivable from an upload request
...@@ -161,14 +161,10 @@ func (r *uploadRequest) doUpload( ...@@ -161,14 +161,10 @@ func (r *uploadRequest) doUpload(
} }
} }
if resErr := r.storeFileAndMetadata( return r.storeFileAndMetadata(
ctx, tmpDir, cfg.Media.AbsBasePath, db, cfg.Media.ThumbnailSizes, ctx, tmpDir, cfg.Media.AbsBasePath, db, cfg.Media.ThumbnailSizes,
activeThumbnailGeneration, cfg.Media.MaxThumbnailGenerators, activeThumbnailGeneration, cfg.Media.MaxThumbnailGenerators,
); resErr != nil { )
return resErr
}
return nil
} }
// Validate validates the uploadRequest fields // Validate validates the uploadRequest fields
......
...@@ -23,15 +23,13 @@ type statements struct { ...@@ -23,15 +23,13 @@ type statements struct {
thumbnail thumbnailStatements thumbnail thumbnailStatements
} }
func (s *statements) prepare(db *sql.DB) error { func (s *statements) prepare(db *sql.DB) (err error) {
var err error
if err = s.media.prepare(db); err != nil { if err = s.media.prepare(db); err != nil {
return err return
} }
if err = s.thumbnail.prepare(db); err != nil { if err = s.thumbnail.prepare(db); err != nil {
return err return
} }
return nil return
} }
...@@ -79,11 +79,7 @@ func (r *RoomserverAliasAPI) SetRoomAlias( ...@@ -79,11 +79,7 @@ func (r *RoomserverAliasAPI) SetRoomAlias(
// At this point we've already committed the alias to the database so we // At this point we've already committed the alias to the database so we
// shouldn't cancel this request. // shouldn't cancel this request.
// TODO: Ensure that we send unsent events when if server restarts. // TODO: Ensure that we send unsent events when if server restarts.
if err := r.sendUpdatedAliasesEvent(context.TODO(), request.UserID, request.RoomID); err != nil { return r.sendUpdatedAliasesEvent(context.TODO(), request.UserID, request.RoomID)
return err
}
return nil
} }
// GetAliasRoomID implements api.RoomserverAliasAPI // GetAliasRoomID implements api.RoomserverAliasAPI
...@@ -123,11 +119,7 @@ func (r *RoomserverAliasAPI) RemoveRoomAlias( ...@@ -123,11 +119,7 @@ func (r *RoomserverAliasAPI) RemoveRoomAlias(
// At this point we've already committed the alias to the database so we // At this point we've already committed the alias to the database so we
// shouldn't cancel this request. // shouldn't cancel this request.
// TODO: Ensure that we send unsent events when if server restarts. // TODO: Ensure that we send unsent events when if server restarts.
if err := r.sendUpdatedAliasesEvent(context.TODO(), request.UserID, roomID); err != nil { return r.sendUpdatedAliasesEvent(context.TODO(), request.UserID, roomID)
return err
}
return nil
} }
type roomAliasesContent struct { type roomAliasesContent struct {
......
...@@ -129,11 +129,7 @@ func processRoomEvent( ...@@ -129,11 +129,7 @@ func processRoomEvent(
} }
// Update the extremities of the event graph for the room // Update the extremities of the event graph for the room
if err := updateLatestEvents(ctx, db, ow, roomNID, stateAtEvent, event, input.SendAsServer); err != nil { return updateLatestEvents(ctx, db, ow, roomNID, stateAtEvent, event, input.SendAsServer)
return err
}
return nil
} }
func processInviteEvent( func processInviteEvent(
......
...@@ -162,11 +162,7 @@ func (u *latestEventsUpdater) doUpdateLatestEvents() error { ...@@ -162,11 +162,7 @@ func (u *latestEventsUpdater) doUpdateLatestEvents() error {
return err return err
} }
if err = u.updater.MarkEventAsSent(u.stateAtEvent.EventNID); err != nil { return u.updater.MarkEventAsSent(u.stateAtEvent.EventNID)
return err
}
return nil
} }
func (u *latestEventsUpdater) latestState() error { func (u *latestEventsUpdater) latestState() error {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册