Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump go to 1.21 #178

Merged
merged 11 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -38,18 +38,23 @@ 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

build_documentation:
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
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ linters:
- sqlclosecheck
- structcheck
- wastedassign
- depguard # Whitelist is not suitable
- tagalign # Visual only

linters-settings:
cyclop:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM cubicrootxyz/matrix-go:1.19 as builder
FROM cubicrootxyz/matrix-go:1.21 as builder

WORKDIR /run

Expand Down
2 changes: 1 addition & 1 deletion cmd/remindme/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/database/reminder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions internal/encryption/initializers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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://", ""))

Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion internal/encryption/state_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion internal/matrixsyncer/action_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion internal/matrixsyncer/action_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion internal/matrixsyncer/action_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/matrixsyncer/reaction_action_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion internal/matrixsyncer/reaction_action_done.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion internal/matrixsyncer/reaction_action_reschedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion internal/synchandler/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/synchandler/reaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/synchandler/state_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down