diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c06e4a60..b3ea32fe 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest if: "!startsWith(github.ref, 'refs/tags/')" container: - image: cubicrootxyz/matrix-go:1.19 + image: cubicrootxyz/matrix-go:1.21 options: --user root services: database: @@ -38,10 +38,15 @@ jobs: runs-on: ubuntu-latest if: "!startsWith(github.ref, 'refs/tags/')" container: + # Updated 1.21 image has some trouble, therefore stick with the old one + # until those are resolved. image: cubicrootxyz/matrix-go:1.19 options: --user root steps: - - uses: actions/checkout@v3 + - name: Checkout the repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} - name: Run golangci run: golangci-lint run --timeout 3m0s @@ -49,7 +54,7 @@ jobs: runs-on: ubuntu-latest if: "!startsWith(github.ref, 'refs/tags/')" container: - image: cubicrootxyz/matrix-go:1.19 + image: cubicrootxyz/matrix-go:1.21 options: --user root steps: - name: Checkout the repository diff --git a/.golangci.yml b/.golangci.yml index f03d5cf6..7a23d551 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -44,6 +44,8 @@ linters: - sqlclosecheck - structcheck - wastedassign + - depguard # Whitelist is not suitable + - tagalign # Visual only linters-settings: cyclop: diff --git a/Dockerfile b/Dockerfile index a23ae316..57d8eb43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM cubicrootxyz/matrix-go:1.19 as builder +FROM cubicrootxyz/matrix-go:1.21 as builder WORKDIR /run diff --git a/cmd/remindme/main.go b/cmd/remindme/main.go index 468d11e4..098176c6 100644 --- a/cmd/remindme/main.go +++ b/cmd/remindme/main.go @@ -27,7 +27,7 @@ import ( ) // @title Matrix Reminder and Calendar Bot (RemindMe) -// @version 1.8.0 +// @version 1.9.2 // @description API documentation for the matrix reminder and calendar bot. [Inprint & Privacy Policy](https://cubicroot.xyz/impressum) // @contact.name Support diff --git a/internal/database/reminder.go b/internal/database/reminder.go index 8af33ca5..844a3beb 100644 --- a/internal/database/reminder.go +++ b/internal/database/reminder.go @@ -138,7 +138,7 @@ func (d *Database) AddReminder(remindTime time.Time, message string, active bool reminder := Reminder{ Message: message, RemindTime: remindTime.UTC(), - Active: true, + Active: active, RepeatInterval: repeatInterval, RepeatMax: 0, Channel: *channel, diff --git a/internal/encryption/initializers.go b/internal/encryption/initializers.go index 47a7abf8..247acaea 100644 --- a/internal/encryption/initializers.go +++ b/internal/encryption/initializers.go @@ -21,7 +21,7 @@ import ( // GetCryptoStore initializes a sql crypto store // //lint:ignore SA4009 Try to move to MySQL later -func GetCryptoStore(debug bool, db *sql.DB, config *configuration.Matrix) (crypto.Store, id.DeviceID, error) { +func GetCryptoStore(_ bool, db *sql.DB, config *configuration.Matrix) (crypto.Store, id.DeviceID, error) { var deviceID id.DeviceID username := fmt.Sprintf("@%s:%s", config.Username, strings.ReplaceAll(strings.ReplaceAll(config.Homeserver, "https://", ""), "http://", "")) @@ -59,7 +59,7 @@ func GetCryptoStore(debug bool, db *sql.DB, config *configuration.Matrix) (crypt } // GetOlmMachine initializes a new olm machine -func GetOlmMachine(debug bool, client *mautrix.Client, store crypto.Store, database types.Database, stateStore *StateStore) *crypto.OlmMachine { +func GetOlmMachine(debug bool, client *mautrix.Client, store crypto.Store, _ types.Database, stateStore *StateStore) *crypto.OlmMachine { if client == nil { log.Warn("client nil") panic("client nil") diff --git a/internal/encryption/state_store.go b/internal/encryption/state_store.go index 5e620332..d70fc1f4 100644 --- a/internal/encryption/state_store.go +++ b/internal/encryption/state_store.go @@ -73,7 +73,7 @@ func (store *StateStore) FindSharedRooms(userID id.UserID) []id.RoomID { return rooms } -func (store *StateStore) SetMembership(event *event.Event) { +func (store *StateStore) SetMembership(_ *event.Event) { // Do not do anything, this is already handled elsewhere } diff --git a/internal/matrixsyncer/action_commands.go b/internal/matrixsyncer/action_commands.go index 43fcff66..c307fa2d 100644 --- a/internal/matrixsyncer/action_commands.go +++ b/internal/matrixsyncer/action_commands.go @@ -22,7 +22,7 @@ func (s *Syncer) getActionCommands() *types.Action { } // actionCommands lists all available commands -func (s *Syncer) actionCommands(evt *types.MessageEvent, channel *database.Channel) error { +func (s *Syncer) actionCommands(_ *types.MessageEvent, channel *database.Channel) error { msg := formater.Formater{} s.getCommandsFormatted(&msg) diff --git a/internal/matrixsyncer/action_delete.go b/internal/matrixsyncer/action_delete.go index 2226215b..02fd6ad9 100644 --- a/internal/matrixsyncer/action_delete.go +++ b/internal/matrixsyncer/action_delete.go @@ -20,7 +20,7 @@ func (s *Syncer) getActionDelete() *types.Action { } // actionList performs the action "list" that writes all pending reminders to the given channel -func (s *Syncer) actionDelete(evt *types.MessageEvent, channel *database.Channel) error { +func (s *Syncer) actionDelete(_ *types.MessageEvent, channel *database.Channel) error { msg := "Removed all your channels and data. If you have channels open I invited you into please ask the administrator to remove you from the configuration file." err := s.daemon.Database.DeleteChannelsFromUser(channel.UserIdentifier) diff --git a/internal/matrixsyncer/action_list.go b/internal/matrixsyncer/action_list.go index 9ed28ddb..fdf327ed 100644 --- a/internal/matrixsyncer/action_list.go +++ b/internal/matrixsyncer/action_list.go @@ -22,7 +22,7 @@ func (s *Syncer) getActionList() *types.Action { } // actionList performs the action "list" that writes all pending reminders to the given channel -func (s *Syncer) actionList(evt *types.MessageEvent, channel *database.Channel) error { +func (s *Syncer) actionList(_ *types.MessageEvent, channel *database.Channel) error { reminders, err := s.daemon.Database.GetPendingReminders(channel) if err != nil { return err diff --git a/internal/matrixsyncer/reaction_action_delete.go b/internal/matrixsyncer/reaction_action_delete.go index 72601f59..a0fc12e4 100644 --- a/internal/matrixsyncer/reaction_action_delete.go +++ b/internal/matrixsyncer/reaction_action_delete.go @@ -22,7 +22,7 @@ func (s *Syncer) getReactionActionDelete(rat types.ReactionActionType) *types.Re return action } -func (s *Syncer) reactionActionDeleteReminder(message *database.Message, content *event.ReactionEventContent, evt *event.Event, channel *database.Channel) error { +func (s *Syncer) reactionActionDeleteReminder(message *database.Message, _ *event.ReactionEventContent, _ *event.Event, channel *database.Channel) error { if channel == nil { return errors.ErrEmptyChannel } diff --git a/internal/matrixsyncer/reaction_action_delete_daily_reminder.go b/internal/matrixsyncer/reaction_action_delete_daily_reminder.go index 5e66fd54..6570d9cf 100644 --- a/internal/matrixsyncer/reaction_action_delete_daily_reminder.go +++ b/internal/matrixsyncer/reaction_action_delete_daily_reminder.go @@ -18,7 +18,7 @@ func (s *Syncer) getReactionActionDeleteDailyReminder(rat types.ReactionActionTy return action } -func (s *Syncer) reactionActionDeleteDailyReminder(message *database.Message, content *event.ReactionEventContent, evt *event.Event, channel *database.Channel) error { +func (s *Syncer) reactionActionDeleteDailyReminder(_ *database.Message, _ *event.ReactionEventContent, _ *event.Event, channel *database.Channel) error { c, err := s.daemon.Database.UpdateChannel(channel.ID, channel.TimeZone, nil, channel.Role) if err != nil { log.Error(err.Error()) diff --git a/internal/matrixsyncer/reaction_action_done.go b/internal/matrixsyncer/reaction_action_done.go index ee7c5c31..1a78014e 100644 --- a/internal/matrixsyncer/reaction_action_done.go +++ b/internal/matrixsyncer/reaction_action_done.go @@ -20,7 +20,7 @@ func (s *Syncer) getReactionActionDone(rat types.ReactionActionType) *types.Reac return action } -func (s *Syncer) reactionActionDoneReminder(message *database.Message, content *event.ReactionEventContent, evt *event.Event, channel *database.Channel) error { +func (s *Syncer) reactionActionDoneReminder(message *database.Message, _ *event.ReactionEventContent, _ *event.Event, channel *database.Channel) error { if channel == nil { return errors.ErrEmptyChannel } diff --git a/internal/matrixsyncer/reaction_action_reschedule.go b/internal/matrixsyncer/reaction_action_reschedule.go index 8e9a3782..484f67e6 100644 --- a/internal/matrixsyncer/reaction_action_reschedule.go +++ b/internal/matrixsyncer/reaction_action_reschedule.go @@ -22,7 +22,7 @@ func (s *Syncer) getReactionActionReschedule(rat types.ReactionActionType) *type return action } -func (s *Syncer) reactionActionRescheduleReminder(message *database.Message, content *event.ReactionEventContent, evt *event.Event, channel *database.Channel) error { +func (s *Syncer) reactionActionRescheduleReminder(message *database.Message, _ *event.ReactionEventContent, _ *event.Event, channel *database.Channel) error { if channel == nil { return errors.ErrEmptyChannel } diff --git a/internal/synchandler/message.go b/internal/synchandler/message.go index 04f571ac..a50f999a 100644 --- a/internal/synchandler/message.go +++ b/internal/synchandler/message.go @@ -43,7 +43,7 @@ func NewMessageHandler(database types.Database, messenger asyncmessenger.Messeng } // NewEvent takes a new matrix event and handles it -func (s *MessageHandler) NewEvent(source mautrix.EventSource, evt *event.Event) { +func (s *MessageHandler) NewEvent(_ mautrix.EventSource, evt *event.Event) { log.Debug(fmt.Sprintf("New message: / Sender: %s / Room: / %s / Time: %d", evt.Sender, evt.RoomID, evt.Timestamp)) // Do not answer our own and old messages diff --git a/internal/synchandler/reaction.go b/internal/synchandler/reaction.go index 4af89760..de16de49 100644 --- a/internal/synchandler/reaction.go +++ b/internal/synchandler/reaction.go @@ -33,7 +33,7 @@ func NewReactionHandler(database types.Database, messenger asyncmessenger.Messen } // NewEvent takes a new matrix event and handles it -func (s *ReactionHandler) NewEvent(source mautrix.EventSource, evt *event.Event) { +func (s *ReactionHandler) NewEvent(_ mautrix.EventSource, evt *event.Event) { log.Debug(fmt.Sprintf("New reaction: / Sender: %s / Room: / %s / Time: %d", evt.Sender, evt.RoomID, evt.Timestamp)) // Do not answer our own and old messages diff --git a/internal/synchandler/state_member.go b/internal/synchandler/state_member.go index dde5ffe3..9176525c 100644 --- a/internal/synchandler/state_member.go +++ b/internal/synchandler/state_member.go @@ -42,7 +42,7 @@ func NewStateMemberHandler(database types.Database, messenger asyncmessenger.Mes } // NewEvent takes a new matrix event and handles it -func (s *StateMemberHandler) NewEvent(source mautrix.EventSource, evt *event.Event) { +func (s *StateMemberHandler) NewEvent(_ mautrix.EventSource, evt *event.Event) { if s.olm != nil { s.olm.HandleMemberEvent(evt) }