diff --git a/.drone.yml b/.drone.yml index b516a40e26..876414e2f0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -141,7 +141,7 @@ steps: commands: - export "GOROOT=$(go env GOROOT)" - apk --no-cache add build-base git - - wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.2 + - wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.1 - ./mage-static check:all when: event: [ push, tag, pull_request ] @@ -731,6 +731,6 @@ steps: - failure --- kind: signature -hmac: f1743e2bb4ca8e5d8df1e222720feb4eac91e15a5ef74d4b54f1df246f2353fe +hmac: 166caa5ba66cd55bc0f1c5cb42be0a0a647fbadf66716778cf795fc084fc80fd ... diff --git a/magefile.go b/magefile.go index 21dd9cfcde..2e4f49c778 100644 --- a/magefile.go +++ b/magefile.go @@ -405,7 +405,7 @@ func checkGolangCiLintInstalled() { mg.Deps(initVars) if err := exec.Command("golangci-lint").Run(); err != nil && strings.Contains(err.Error(), "executable file not found") { fmt.Println("Please manually install golangci-lint by running") - fmt.Println("curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.2") + fmt.Println("curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.1") os.Exit(1) } } diff --git a/pkg/log/noop.go b/pkg/log/noop.go index 2824c40e6f..9075c9e361 100644 --- a/pkg/log/noop.go +++ b/pkg/log/noop.go @@ -23,6 +23,6 @@ import ( // NoopBackend doesn't log anything. Used in cases where we want to disable logging completely. type NoopBackend struct{} -func (n *NoopBackend) Log(level logging.Level, i int, record *logging.Record) error { +func (n *NoopBackend) Log(_ logging.Level, _ int, _ *logging.Record) error { return nil } diff --git a/pkg/log/watermill_logger.go b/pkg/log/watermill_logger.go index 1f49829cd2..eae09ae765 100644 --- a/pkg/log/watermill_logger.go +++ b/pkg/log/watermill_logger.go @@ -91,6 +91,6 @@ func (w *WatermillLogger) Trace(msg string, fields watermill.LogFields) { w.logger.Debugf("%s, %s", msg, concatFields(fields)) } -func (w *WatermillLogger) With(fields watermill.LogFields) watermill.LoggerAdapter { +func (w *WatermillLogger) With(_ watermill.LogFields) watermill.LoggerAdapter { return w } diff --git a/pkg/migration/migration.go b/pkg/migration/migration.go index 612042e7c0..cbd9ddaa56 100644 --- a/pkg/migration/migration.go +++ b/pkg/migration/migration.go @@ -109,10 +109,7 @@ func Rollback(migrationID string) { // MigrateTo executes all migrations up to a certain point func MigrateTo(migrationID string, x *xorm.Engine) error { m := initMigration(x) - if err := m.MigrateTo(migrationID); err != nil { - return err - } - return nil + return m.MigrateTo(migrationID) } // Deletes a column from a table. All arguments are strings, to let them be standalone and not depending on any struct. diff --git a/pkg/models/kanban.go b/pkg/models/kanban.go index a7f3242f43..01905288d1 100644 --- a/pkg/models/kanban.go +++ b/pkg/models/kanban.go @@ -281,7 +281,7 @@ func (b *Bucket) Create(s *xorm.Session, a web.Auth) (err error) { // @Failure 404 {object} web.HTTPError "The bucket does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /projects/{projectID}/buckets/{bucketID} [post] -func (b *Bucket) Update(s *xorm.Session, a web.Auth) (err error) { +func (b *Bucket) Update(s *xorm.Session, _ web.Auth) (err error) { doneBucket, err := getDoneBucketForProject(s, b.ProjectID) if err != nil { return err @@ -320,7 +320,7 @@ func (b *Bucket) Update(s *xorm.Session, a web.Auth) (err error) { // @Failure 404 {object} web.HTTPError "The bucket does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /projects/{projectID}/buckets/{bucketID} [delete] -func (b *Bucket) Delete(s *xorm.Session, a web.Auth) (err error) { +func (b *Bucket) Delete(s *xorm.Session, _ web.Auth) (err error) { // Prevent removing the last bucket total, err := s.Where("project_id = ?", b.ProjectID).Count(&Bucket{}) diff --git a/pkg/models/label.go b/pkg/models/label.go index 5658f1069f..5f4bcbd059 100644 --- a/pkg/models/label.go +++ b/pkg/models/label.go @@ -123,7 +123,7 @@ func (l *Label) Update(s *xorm.Session, a web.Auth) (err error) { // @Failure 404 {object} web.HTTPError "Label not found." // @Failure 500 {object} models.Message "Internal error" // @Router /labels/{id} [delete] -func (l *Label) Delete(s *xorm.Session, a web.Auth) (err error) { +func (l *Label) Delete(s *xorm.Session, _ web.Auth) (err error) { _, err = s.ID(l.ID).Delete(&Label{}) return err } @@ -175,7 +175,7 @@ func (l *Label) ReadAll(s *xorm.Session, a web.Auth, search string, page int, pe // @Failure 404 {object} web.HTTPError "Label not found" // @Failure 500 {object} models.Message "Internal error" // @Router /labels/{id} [get] -func (l *Label) ReadOne(s *xorm.Session, a web.Auth) (err error) { +func (l *Label) ReadOne(s *xorm.Session, _ web.Auth) (err error) { label, err := getLabelByIDSimple(s, l.ID) if err != nil { return diff --git a/pkg/models/label_rights.go b/pkg/models/label_rights.go index 196dd10c52..b05b4c704b 100644 --- a/pkg/models/label_rights.go +++ b/pkg/models/label_rights.go @@ -40,7 +40,7 @@ func (l *Label) CanRead(s *xorm.Session, a web.Auth) (bool, int, error) { // CanCreate checks if the user can create a label // Currently a dummy. -func (l *Label) CanCreate(s *xorm.Session, a web.Auth) (bool, error) { +func (l *Label) CanCreate(_ *xorm.Session, a web.Auth) (bool, error) { if _, is := a.(*LinkSharing); is { return false, nil } diff --git a/pkg/models/label_task.go b/pkg/models/label_task.go index 13d7e462ad..190db7fe26 100644 --- a/pkg/models/label_task.go +++ b/pkg/models/label_task.go @@ -64,7 +64,7 @@ func (LabelTask) TableName() string { // @Failure 404 {object} web.HTTPError "Label not found." // @Failure 500 {object} models.Message "Internal error" // @Router /tasks/{task}/labels/{label} [delete] -func (lt *LabelTask) Delete(s *xorm.Session, a web.Auth) (err error) { +func (lt *LabelTask) Delete(s *xorm.Session, _ web.Auth) (err error) { _, err = s.Delete(&LabelTask{LabelID: lt.LabelID, TaskID: lt.TaskID}) return err } @@ -84,7 +84,7 @@ func (lt *LabelTask) Delete(s *xorm.Session, a web.Auth) (err error) { // @Failure 404 {object} web.HTTPError "The label does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /tasks/{task}/labels [put] -func (lt *LabelTask) Create(s *xorm.Session, a web.Auth) (err error) { +func (lt *LabelTask) Create(s *xorm.Session, _ web.Auth) (err error) { // Check if the label is already added exists, err := s.Exist(&LabelTask{LabelID: lt.LabelID, TaskID: lt.TaskID}) if err != nil { @@ -118,7 +118,7 @@ func (lt *LabelTask) Create(s *xorm.Session, a web.Auth) (err error) { // @Success 200 {array} models.Label "The labels" // @Failure 500 {object} models.Message "Internal error" // @Router /tasks/{task}/labels [get] -func (lt *LabelTask) ReadAll(s *xorm.Session, a web.Auth, search string, page int, perPage int) (result interface{}, resultCount int, numberOfTotalItems int64, err error) { +func (lt *LabelTask) ReadAll(s *xorm.Session, a web.Auth, search string, page int, _ int) (result interface{}, resultCount int, numberOfTotalItems int64, err error) { // Check if the user has the right to see the task task := Task{ID: lt.TaskID} canRead, _, err := task.CanRead(s, a) diff --git a/pkg/models/link_sharing.go b/pkg/models/link_sharing.go index a2f6208f89..d91a320ccd 100644 --- a/pkg/models/link_sharing.go +++ b/pkg/models/link_sharing.go @@ -169,7 +169,7 @@ func (share *LinkSharing) Create(s *xorm.Session, a web.Auth) (err error) { // @Failure 404 {object} web.HTTPError "Share Link not found." // @Failure 500 {object} models.Message "Internal error" // @Router /projects/{project}/shares/{share} [get] -func (share *LinkSharing) ReadOne(s *xorm.Session, a web.Auth) (err error) { +func (share *LinkSharing) ReadOne(s *xorm.Session, _ web.Auth) (err error) { exists, err := s.Where("id = ?", share.ID).Get(share) if err != nil { return err @@ -269,7 +269,7 @@ func (share *LinkSharing) ReadAll(s *xorm.Session, a web.Auth, search string, pa // @Failure 404 {object} web.HTTPError "Share Link not found." // @Failure 500 {object} models.Message "Internal error" // @Router /projects/{project}/shares/{share} [delete] -func (share *LinkSharing) Delete(s *xorm.Session, a web.Auth) (err error) { +func (share *LinkSharing) Delete(s *xorm.Session, _ web.Auth) (err error) { _, err = s.Where("id = ?", share.ID).Delete(share) return } diff --git a/pkg/models/listeners.go b/pkg/models/listeners.go index f4dcfcd919..1835539938 100644 --- a/pkg/models/listeners.go +++ b/pkg/models/listeners.go @@ -75,7 +75,7 @@ func (s *IncreaseTaskCounter) Name() string { } // Handle is executed when the event IncreaseTaskCounter listens on is fired -func (s *IncreaseTaskCounter) Handle(msg *message.Message) (err error) { +func (s *IncreaseTaskCounter) Handle(_ *message.Message) (err error) { return keyvalue.IncrBy(metrics.TaskCountKey, 1) } @@ -89,7 +89,7 @@ func (s *DecreaseTaskCounter) Name() string { } // Handle is executed when the event DecreaseTaskCounter listens on is fired -func (s *DecreaseTaskCounter) Handle(msg *message.Message) (err error) { +func (s *DecreaseTaskCounter) Handle(_ *message.Message) (err error) { return keyvalue.DecrBy(metrics.TaskCountKey, 1) } @@ -480,7 +480,7 @@ func (s *IncreaseProjectCounter) Name() string { return "project.counter.increase" } -func (s *IncreaseProjectCounter) Handle(msg *message.Message) (err error) { +func (s *IncreaseProjectCounter) Handle(_ *message.Message) (err error) { return keyvalue.IncrBy(metrics.ProjectCountKey, 1) } @@ -491,7 +491,7 @@ func (s *DecreaseProjectCounter) Name() string { return "project.counter.decrease" } -func (s *DecreaseProjectCounter) Handle(msg *message.Message) (err error) { +func (s *DecreaseProjectCounter) Handle(_ *message.Message) (err error) { return keyvalue.DecrBy(metrics.ProjectCountKey, 1) } @@ -553,7 +553,7 @@ func (s *IncreaseNamespaceCounter) Name() string { } // Hanlde is executed when the event IncreaseNamespaceCounter listens on is fired -func (s *IncreaseNamespaceCounter) Handle(msg *message.Message) (err error) { +func (s *IncreaseNamespaceCounter) Handle(_ *message.Message) (err error) { return keyvalue.IncrBy(metrics.NamespaceCountKey, 1) } @@ -566,8 +566,8 @@ func (s *DecreaseNamespaceCounter) Name() string { return "namespace.counter.decrease" } -// Hanlde is executed when the event DecreaseNamespaceCounter listens on is fired -func (s *DecreaseNamespaceCounter) Handle(msg *message.Message) (err error) { +// Handle is executed when the event DecreaseNamespaceCounter listens on is fired +func (s *DecreaseNamespaceCounter) Handle(_ *message.Message) (err error) { return keyvalue.DecrBy(metrics.NamespaceCountKey, 1) } @@ -583,8 +583,8 @@ func (s *IncreaseTeamCounter) Name() string { return "team.counter.increase" } -// Hanlde is executed when the event IncreaseTeamCounter listens on is fired -func (s *IncreaseTeamCounter) Handle(msg *message.Message) (err error) { +// Handle is executed when the event IncreaseTeamCounter listens on is fired +func (s *IncreaseTeamCounter) Handle(_ *message.Message) (err error) { return keyvalue.IncrBy(metrics.TeamCountKey, 1) } @@ -597,8 +597,8 @@ func (s *DecreaseTeamCounter) Name() string { return "team.counter.decrease" } -// Hanlde is executed when the event DecreaseTeamCounter listens on is fired -func (s *DecreaseTeamCounter) Handle(msg *message.Message) (err error) { +// Handle is executed when the event DecreaseTeamCounter listens on is fired +func (s *DecreaseTeamCounter) Handle(_ *message.Message) (err error) { return keyvalue.DecrBy(metrics.TeamCountKey, 1) } diff --git a/pkg/models/namespace_rights.go b/pkg/models/namespace_rights.go index 36d964897f..f03dbf6988 100644 --- a/pkg/models/namespace_rights.go +++ b/pkg/models/namespace_rights.go @@ -50,7 +50,7 @@ func (n *Namespace) CanDelete(s *xorm.Session, a web.Auth) (bool, error) { } // CanCreate checks if the user can create a new namespace -func (n *Namespace) CanCreate(s *xorm.Session, a web.Auth) (bool, error) { +func (n *Namespace) CanCreate(_ *xorm.Session, a web.Auth) (bool, error) { if _, is := a.(*LinkSharing); is { return false, nil } diff --git a/pkg/models/namespace_team.go b/pkg/models/namespace_team.go index 3929127780..8832561829 100644 --- a/pkg/models/namespace_team.go +++ b/pkg/models/namespace_team.go @@ -124,7 +124,7 @@ func (tn *TeamNamespace) Create(s *xorm.Session, a web.Auth) (err error) { // @Failure 404 {object} web.HTTPError "team or namespace does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /namespaces/{namespaceID}/teams/{teamID} [delete] -func (tn *TeamNamespace) Delete(s *xorm.Session, a web.Auth) (err error) { +func (tn *TeamNamespace) Delete(s *xorm.Session, _ web.Auth) (err error) { // Check if the team exists _, err = GetTeamByID(s, tn.TeamID) @@ -229,7 +229,7 @@ func (tn *TeamNamespace) ReadAll(s *xorm.Session, a web.Auth, search string, pag // @Failure 404 {object} web.HTTPError "Team or namespace does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /namespaces/{namespaceID}/teams/{teamID} [post] -func (tn *TeamNamespace) Update(s *xorm.Session, a web.Auth) (err error) { +func (tn *TeamNamespace) Update(s *xorm.Session, _ web.Auth) (err error) { // Check if the right is valid if err := tn.Right.isValid(); err != nil { diff --git a/pkg/models/namespace_users.go b/pkg/models/namespace_users.go index eda9bfc3e8..716df0181c 100644 --- a/pkg/models/namespace_users.go +++ b/pkg/models/namespace_users.go @@ -133,7 +133,7 @@ func (nu *NamespaceUser) Create(s *xorm.Session, a web.Auth) (err error) { // @Failure 404 {object} web.HTTPError "user or namespace does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /namespaces/{namespaceID}/users/{userID} [delete] -func (nu *NamespaceUser) Delete(s *xorm.Session, a web.Auth) (err error) { +func (nu *NamespaceUser) Delete(s *xorm.Session, _ web.Auth) (err error) { // Check if the user exists user, err := user2.GetUserByUsername(s, nu.Username) @@ -229,7 +229,7 @@ func (nu *NamespaceUser) ReadAll(s *xorm.Session, a web.Auth, search string, pag // @Failure 404 {object} web.HTTPError "User or namespace does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /namespaces/{namespaceID}/users/{userID} [post] -func (nu *NamespaceUser) Update(s *xorm.Session, a web.Auth) (err error) { +func (nu *NamespaceUser) Update(s *xorm.Session, _ web.Auth) (err error) { // Check if the right is valid if err := nu.Right.isValid(); err != nil { diff --git a/pkg/models/notifications_database.go b/pkg/models/notifications_database.go index 278b5a3b6e..9beb78a0db 100644 --- a/pkg/models/notifications_database.go +++ b/pkg/models/notifications_database.go @@ -47,7 +47,7 @@ type DatabaseNotifications struct { // @Failure 403 {object} web.HTTPError "Link shares cannot have notifications." // @Failure 500 {object} models.Message "Internal error" // @Router /notifications [get] -func (d *DatabaseNotifications) ReadAll(s *xorm.Session, a web.Auth, search string, page int, perPage int) (ls interface{}, resultCount int, numberOfEntries int64, err error) { +func (d *DatabaseNotifications) ReadAll(s *xorm.Session, a web.Auth, _ string, page int, perPage int) (ls interface{}, resultCount int, numberOfEntries int64, err error) { if _, is := a.(*LinkSharing); is { return nil, 0, 0, ErrGenericForbidden{} } @@ -79,6 +79,6 @@ func (d *DatabaseNotifications) CanUpdate(s *xorm.Session, a web.Auth) (bool, er // @Failure 404 {object} web.HTTPError "The notification does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /notifications/{id} [post] -func (d *DatabaseNotifications) Update(s *xorm.Session, a web.Auth) (err error) { +func (d *DatabaseNotifications) Update(s *xorm.Session, _ web.Auth) (err error) { return notifications.MarkNotificationAsRead(s, &d.DatabaseNotification, d.Read) } diff --git a/pkg/models/project_team.go b/pkg/models/project_team.go index 6032f2ba40..e89413741c 100644 --- a/pkg/models/project_team.go +++ b/pkg/models/project_team.go @@ -135,7 +135,7 @@ func (tl *TeamProject) Create(s *xorm.Session, a web.Auth) (err error) { // @Failure 404 {object} web.HTTPError "Team or project does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /projects/{projectID}/teams/{teamID} [delete] -func (tl *TeamProject) Delete(s *xorm.Session, a web.Auth) (err error) { +func (tl *TeamProject) Delete(s *xorm.Session, _ web.Auth) (err error) { // Check if the team exists _, err = GetTeamByID(s, tl.TeamID) @@ -247,7 +247,7 @@ func (tl *TeamProject) ReadAll(s *xorm.Session, a web.Auth, search string, page // @Failure 404 {object} web.HTTPError "Team or project does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /projects/{projectID}/teams/{teamID} [post] -func (tl *TeamProject) Update(s *xorm.Session, a web.Auth) (err error) { +func (tl *TeamProject) Update(s *xorm.Session, _ web.Auth) (err error) { // Check if the right is valid if err := tl.Right.isValid(); err != nil { diff --git a/pkg/models/project_users.go b/pkg/models/project_users.go index e9053dd94c..1cf7cfbbfc 100644 --- a/pkg/models/project_users.go +++ b/pkg/models/project_users.go @@ -142,7 +142,7 @@ func (lu *ProjectUser) Create(s *xorm.Session, a web.Auth) (err error) { // @Failure 404 {object} web.HTTPError "user or project does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /projects/{projectID}/users/{userID} [delete] -func (lu *ProjectUser) Delete(s *xorm.Session, a web.Auth) (err error) { +func (lu *ProjectUser) Delete(s *xorm.Session, _ web.Auth) (err error) { // Check if the user exists u, err := user.GetUserByUsername(s, lu.Username) @@ -244,7 +244,7 @@ func (lu *ProjectUser) ReadAll(s *xorm.Session, a web.Auth, search string, page // @Failure 404 {object} web.HTTPError "User or project does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /projects/{projectID}/users/{userID} [post] -func (lu *ProjectUser) Update(s *xorm.Session, a web.Auth) (err error) { +func (lu *ProjectUser) Update(s *xorm.Session, _ web.Auth) (err error) { // Check if the right is valid if err := lu.Right.isValid(); err != nil { diff --git a/pkg/models/saved_filters.go b/pkg/models/saved_filters.go index 9c12f62f09..b2a5958f6e 100644 --- a/pkg/models/saved_filters.go +++ b/pkg/models/saved_filters.go @@ -149,7 +149,7 @@ func getSavedFilterSimpleByID(s *xorm.Session, id int64) (sf *SavedFilter, err e // @Failure 403 {object} web.HTTPError "The user does not have access to that saved filter." // @Failure 500 {object} models.Message "Internal error" // @Router /filters/{id} [get] -func (sf *SavedFilter) ReadOne(s *xorm.Session, a web.Auth) error { +func (sf *SavedFilter) ReadOne(s *xorm.Session, _ web.Auth) error { // s already contains almost the full saved filter from the rights check, we only need to add the user u, err := user.GetUserByID(s, sf.OwnerID) sf.Owner = u @@ -169,7 +169,7 @@ func (sf *SavedFilter) ReadOne(s *xorm.Session, a web.Auth) error { // @Failure 404 {object} web.HTTPError "The saved filter does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /filters/{id} [post] -func (sf *SavedFilter) Update(s *xorm.Session, a web.Auth) error { +func (sf *SavedFilter) Update(s *xorm.Session, _ web.Auth) error { origFilter, err := getSavedFilterSimpleByID(s, sf.ID) if err != nil { return err @@ -204,7 +204,7 @@ func (sf *SavedFilter) Update(s *xorm.Session, a web.Auth) error { // @Failure 404 {object} web.HTTPError "The saved filter does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /filters/{id} [delete] -func (sf *SavedFilter) Delete(s *xorm.Session, a web.Auth) error { +func (sf *SavedFilter) Delete(s *xorm.Session, _ web.Auth) error { _, err := s. Where("id = ?", sf.ID). Delete(sf) diff --git a/pkg/models/saved_filters_rights.go b/pkg/models/saved_filters_rights.go index 96fd0e09a7..de687d5f63 100644 --- a/pkg/models/saved_filters_rights.go +++ b/pkg/models/saved_filters_rights.go @@ -40,7 +40,7 @@ func (sf *SavedFilter) CanUpdate(s *xorm.Session, auth web.Auth) (bool, error) { } // CanCreate checks if a user has the right to update a saved filter -func (sf *SavedFilter) CanCreate(s *xorm.Session, auth web.Auth) (bool, error) { +func (sf *SavedFilter) CanCreate(_ *xorm.Session, auth web.Auth) (bool, error) { if _, is := auth.(*LinkSharing); is { return false, nil } diff --git a/pkg/models/task_attachment.go b/pkg/models/task_attachment.go index 0251bed0f8..1d4e96bfd9 100644 --- a/pkg/models/task_attachment.go +++ b/pkg/models/task_attachment.go @@ -94,7 +94,7 @@ func (ta *TaskAttachment) NewAttachment(s *xorm.Session, f io.ReadCloser, realna } // ReadOne returns a task attachment -func (ta *TaskAttachment) ReadOne(s *xorm.Session, a web.Auth) (err error) { +func (ta *TaskAttachment) ReadOne(s *xorm.Session, _ web.Auth) (err error) { exists, err := s.Where("id = ?", ta.ID).Get(ta) if err != nil { return @@ -127,7 +127,7 @@ func (ta *TaskAttachment) ReadOne(s *xorm.Session, a web.Auth) (err error) { // @Failure 404 {object} models.Message "The task does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /tasks/{id}/attachments [get] -func (ta *TaskAttachment) ReadAll(s *xorm.Session, a web.Auth, search string, page int, perPage int) (result interface{}, resultCount int, numberOfTotalItems int64, err error) { +func (ta *TaskAttachment) ReadAll(s *xorm.Session, _ web.Auth, _ string, page int, perPage int) (result interface{}, resultCount int, numberOfTotalItems int64, err error) { attachments := []*TaskAttachment{} limit, start := getLimitFromPageIndex(page, perPage) diff --git a/pkg/models/task_comments.go b/pkg/models/task_comments.go index 0c0514dd3b..7d099047f5 100644 --- a/pkg/models/task_comments.go +++ b/pkg/models/task_comments.go @@ -101,7 +101,7 @@ func (tc *TaskComment) Create(s *xorm.Session, a web.Auth) (err error) { // @Failure 404 {object} web.HTTPError "The task comment was not found." // @Failure 500 {object} models.Message "Internal error" // @Router /tasks/{taskID}/comments/{commentID} [delete] -func (tc *TaskComment) Delete(s *xorm.Session, a web.Auth) error { +func (tc *TaskComment) Delete(s *xorm.Session, _ web.Auth) error { deleted, err := s. ID(tc.ID). NoAutoCondition(). @@ -135,7 +135,7 @@ func (tc *TaskComment) Delete(s *xorm.Session, a web.Auth) error { // @Failure 404 {object} web.HTTPError "The task comment was not found." // @Failure 500 {object} models.Message "Internal error" // @Router /tasks/{taskID}/comments/{commentID} [post] -func (tc *TaskComment) Update(s *xorm.Session, a web.Auth) error { +func (tc *TaskComment) Update(s *xorm.Session, _ web.Auth) error { updated, err := s. ID(tc.ID). Cols("comment"). @@ -192,7 +192,7 @@ func getTaskCommentSimple(s *xorm.Session, tc *TaskComment) error { // @Failure 404 {object} web.HTTPError "The task comment was not found." // @Failure 500 {object} models.Message "Internal error" // @Router /tasks/{taskID}/comments/{commentID} [get] -func (tc *TaskComment) ReadOne(s *xorm.Session, a web.Auth) (err error) { +func (tc *TaskComment) ReadOne(s *xorm.Session, _ web.Auth) (err error) { err = getTaskCommentSimple(s, tc) if err != nil { return err diff --git a/pkg/models/tasks.go b/pkg/models/tasks.go index 3f75622e01..6ff52a10b1 100644 --- a/pkg/models/tasks.go +++ b/pkg/models/tasks.go @@ -194,7 +194,7 @@ type taskOptions struct { // @Success 200 {array} models.Task "The tasks" // @Failure 500 {object} models.Message "Internal error" // @Router /tasks/all [get] -func (t *Task) ReadAll(s *xorm.Session, a web.Auth, search string, page int, perPage int) (result interface{}, resultCount int, totalItems int64, err error) { +func (t *Task) ReadAll(_ *xorm.Session, _ web.Auth, _ string, _ int, _ int) (result interface{}, resultCount int, totalItems int64, err error) { return nil, 0, 0, nil } diff --git a/pkg/models/team_members.go b/pkg/models/team_members.go index f236f5f97c..faf176d774 100644 --- a/pkg/models/team_members.go +++ b/pkg/models/team_members.go @@ -88,7 +88,7 @@ func (tm *TeamMember) Create(s *xorm.Session, a web.Auth) (err error) { // @Success 200 {object} models.Message "The user was successfully removed from the team." // @Failure 500 {object} models.Message "Internal error" // @Router /teams/{id}/members/{userID} [delete] -func (tm *TeamMember) Delete(s *xorm.Session, a web.Auth) (err error) { +func (tm *TeamMember) Delete(s *xorm.Session, _ web.Auth) (err error) { total, err := s.Where("team_id = ?", tm.TeamID).Count(&TeamMember{}) if err != nil { @@ -120,7 +120,7 @@ func (tm *TeamMember) Delete(s *xorm.Session, a web.Auth) (err error) { // @Success 200 {object} models.Message "The member right was successfully changed." // @Failure 500 {object} models.Message "Internal error" // @Router /teams/{id}/members/{userID}/admin [post] -func (tm *TeamMember) Update(s *xorm.Session, a web.Auth) (err error) { +func (tm *TeamMember) Update(s *xorm.Session, _ web.Auth) (err error) { // Find the numeric user id user, err := user2.GetUserByUsername(s, tm.Username) if err != nil { diff --git a/pkg/models/teams.go b/pkg/models/teams.go index 12a39095f0..cd067dbf48 100644 --- a/pkg/models/teams.go +++ b/pkg/models/teams.go @@ -184,7 +184,7 @@ func addMoreInfoToTeams(s *xorm.Session, teams []*Team) (err error) { // @Failure 403 {object} web.HTTPError "The user does not have access to the team" // @Failure 500 {object} models.Message "Internal error" // @Router /teams/{id} [get] -func (t *Team) ReadOne(s *xorm.Session, a web.Auth) (err error) { +func (t *Team) ReadOne(s *xorm.Session, _ web.Auth) (err error) { team, err := GetTeamByID(s, t.ID) if team != nil { *t = *team @@ -338,7 +338,7 @@ func (t *Team) Delete(s *xorm.Session, a web.Auth) (err error) { // @Failure 400 {object} web.HTTPError "Invalid team object provided." // @Failure 500 {object} models.Message "Internal error" // @Router /teams/{id} [post] -func (t *Team) Update(s *xorm.Session, a web.Auth) (err error) { +func (t *Team) Update(s *xorm.Session, _ web.Auth) (err error) { // Check if we have a name if t.Name == "" { return ErrTeamNameCannotBeEmpty{} diff --git a/pkg/models/teams_rights.go b/pkg/models/teams_rights.go index 3a77ef3ce9..258c471fec 100644 --- a/pkg/models/teams_rights.go +++ b/pkg/models/teams_rights.go @@ -22,7 +22,7 @@ import ( ) // CanCreate checks if the user can create a new team -func (t *Team) CanCreate(s *xorm.Session, a web.Auth) (bool, error) { +func (t *Team) CanCreate(_ *xorm.Session, a web.Auth) (bool, error) { if _, is := a.(*LinkSharing); is { return false, nil } diff --git a/pkg/modules/avatar/empty/empty.go b/pkg/modules/avatar/empty/empty.go index 141df10b7a..6e2b4b311d 100644 --- a/pkg/modules/avatar/empty/empty.go +++ b/pkg/modules/avatar/empty/empty.go @@ -40,6 +40,6 @@ const defaultAvatar string = ` ` // GetAvatar implements getting the avatar method -func (p *Provider) GetAvatar(user *user.User, size int64) (avatar []byte, mimeType string, err error) { +func (p *Provider) GetAvatar(_ *user.User, _ int64) (avatar []byte, mimeType string, err error) { return []byte(defaultAvatar), "image/svg+xml", nil } diff --git a/pkg/modules/background/unsplash/unsplash.go b/pkg/modules/background/unsplash/unsplash.go index a10cadfa0c..4f063529f4 100644 --- a/pkg/modules/background/unsplash/unsplash.go +++ b/pkg/modules/background/unsplash/unsplash.go @@ -151,7 +151,7 @@ func getUnsplashPhotoInfoByID(photoID string) (photo *Photo, err error) { // @Success 200 {array} background.Image "An array with photos" // @Failure 500 {object} models.Message "Internal error" // @Router /backgrounds/unsplash/search [get] -func (p *Provider) Search(s *xorm.Session, search string, page int64) (result []*background.Image, err error) { +func (p *Provider) Search(_ *xorm.Session, search string, page int64) (result []*background.Image, err error) { // If we don't have a search query, return results from the unsplash featured collection if search == "" { diff --git a/pkg/modules/background/upload/upload.go b/pkg/modules/background/upload/upload.go index 072c0c5bd9..b0c5d25697 100644 --- a/pkg/modules/background/upload/upload.go +++ b/pkg/modules/background/upload/upload.go @@ -32,7 +32,7 @@ type Provider struct { } // Search is only used to implement the interface -func (p *Provider) Search(s *xorm.Session, search string, page int64) (result []*background.Image, err error) { +func (p *Provider) Search(_ *xorm.Session, _ string, _ int64) (result []*background.Image, err error) { return } @@ -52,7 +52,7 @@ func (p *Provider) Search(s *xorm.Session, search string, page int64) (result [] // @Failure 404 {object} models.Message "The project does not exist." // @Failure 500 {object} models.Message "Internal error" // @Router /projects/{id}/backgrounds/upload [put] -func (p *Provider) Set(s *xorm.Session, img *background.Image, project *models.Project, auth web.Auth) (err error) { +func (p *Provider) Set(s *xorm.Session, img *background.Image, project *models.Project, _ web.Auth) (err error) { // Remove the old background if one exists err = project.DeleteBackgroundFileIfExists() if err != nil { diff --git a/pkg/routes/caldav/listStorageProvider.go b/pkg/routes/caldav/listStorageProvider.go index 88841670fb..cdf9f925d4 100644 --- a/pkg/routes/caldav/listStorageProvider.go +++ b/pkg/routes/caldav/listStorageProvider.go @@ -51,7 +51,7 @@ type VikunjaCaldavProjectStorage struct { } // GetResources returns either all projects, links to the principal, or only one project, depending on the request -func (vcls *VikunjaCaldavProjectStorage) GetResources(rpath string, withChildren bool) ([]data.Resource, error) { +func (vcls *VikunjaCaldavProjectStorage) GetResources(rpath string, _ bool) ([]data.Resource, error) { // It looks like we need to have the same handler for returning both the calendar home set and the user principal // Since the client seems to ignore the whatever is being returned in the first request and just makes a second one @@ -166,7 +166,7 @@ func (vcls *VikunjaCaldavProjectStorage) GetResourcesByList(rpaths []string) ([] } // GetResourcesByFilters fetches a project of resources with a filter -func (vcls *VikunjaCaldavProjectStorage) GetResourcesByFilters(rpath string, filters *data.ResourceFilter) ([]data.Resource, error) { +func (vcls *VikunjaCaldavProjectStorage) GetResourcesByFilters(rpath string, _ *data.ResourceFilter) ([]data.Resource, error) { // If we already have a project saved, that means the user is making a REPORT request to find out if // anything changed, in that case we need to return all tasks. @@ -359,7 +359,7 @@ func (vcls *VikunjaCaldavProjectStorage) UpdateResource(rpath, content string) ( } // DeleteResource deletes a resource -func (vcls *VikunjaCaldavProjectStorage) DeleteResource(rpath string) error { +func (vcls *VikunjaCaldavProjectStorage) DeleteResource(_ string) error { if vcls.task != nil { s := db.NewSession() defer s.Close() diff --git a/pkg/user/listeners.go b/pkg/user/listeners.go index 0e96969d41..20d9282f24 100644 --- a/pkg/user/listeners.go +++ b/pkg/user/listeners.go @@ -39,7 +39,7 @@ func (s *IncreaseUserCounter) Name() string { return "increase.user.counter" } -// Hanlde is executed when the event IncreaseUserCounter listens on is fired -func (s *IncreaseUserCounter) Handle(msg *message.Message) (err error) { +// Handle is executed when the event IncreaseUserCounter listens on is fired +func (s *IncreaseUserCounter) Handle(_ *message.Message) (err error) { return keyvalue.IncrBy(metrics.UserCountKey, 1) }