From 3acc13038dfe5e0643112140d329c6eb0ed4cd6a Mon Sep 17 00:00:00 2001
From: "deepsource-autofix[bot]"
 <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Date: Sun, 6 Mar 2022 15:46:21 +0800
Subject: autofix: unused parameter should be replaced by underscore (#6799)

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
---
 internal/db/action.go        | 2 +-
 internal/db/login_sources.go | 4 ++--
 internal/db/repo.go          | 2 +-
 internal/db/repos.go         | 2 +-
 internal/db/two_factor.go    | 2 +-
 internal/db/two_factors.go   | 2 +-
 internal/db/users.go         | 2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

(limited to 'internal/db')

diff --git a/internal/db/action.go b/internal/db/action.go
index 292e936a..a9efeeb8 100644
--- a/internal/db/action.go
+++ b/internal/db/action.go
@@ -175,7 +175,7 @@ func (a *Action) GetIssueContent() string {
 	return issue.Content
 }
 
-func newRepoAction(e Engine, doer, owner *User, repo *Repository) (err error) {
+func newRepoAction(e Engine, doer, _ *User, repo *Repository) (err error) {
 	opType := ACTION_CREATE_REPO
 	if repo.IsFork {
 		opType = ACTION_FORK_REPO
diff --git a/internal/db/login_sources.go b/internal/db/login_sources.go
index 1cce7829..79a23662 100644
--- a/internal/db/login_sources.go
+++ b/internal/db/login_sources.go
@@ -66,7 +66,7 @@ type LoginSource struct {
 }
 
 // NOTE: This is a GORM save hook.
-func (s *LoginSource) BeforeSave(tx *gorm.DB) (err error) {
+func (s *LoginSource) BeforeSave(_ *gorm.DB) (err error) {
 	if s.Provider == nil {
 		return nil
 	}
@@ -90,7 +90,7 @@ func (s *LoginSource) BeforeUpdate(tx *gorm.DB) error {
 }
 
 // NOTE: This is a GORM query hook.
-func (s *LoginSource) AfterFind(tx *gorm.DB) error {
+func (s *LoginSource) AfterFind(_ *gorm.DB) error {
 	s.Created = time.Unix(s.CreatedUnix, 0).Local()
 	s.Updated = time.Unix(s.UpdatedUnix, 0).Local()
 
diff --git a/internal/db/repo.go b/internal/db/repo.go
index f4a9f0ff..c858f2eb 100644
--- a/internal/db/repo.go
+++ b/internal/db/repo.go
@@ -1746,7 +1746,7 @@ func GetUserAndCollaborativeRepositories(userID int64) ([]*Repository, error) {
 	return append(repos, ownRepos...), nil
 }
 
-func getRepositoryCount(e Engine, u *User) (int64, error) {
+func getRepositoryCount(_ Engine, u *User) (int64, error) {
 	return x.Count(&Repository{OwnerID: u.ID})
 }
 
diff --git a/internal/db/repos.go b/internal/db/repos.go
index fc5bce03..ecdbc0a5 100644
--- a/internal/db/repos.go
+++ b/internal/db/repos.go
@@ -40,7 +40,7 @@ func (r *Repository) BeforeUpdate(tx *gorm.DB) error {
 }
 
 // NOTE: This is a GORM query hook.
-func (r *Repository) AfterFind(tx *gorm.DB) error {
+func (r *Repository) AfterFind(_ *gorm.DB) error {
 	r.Created = time.Unix(r.CreatedUnix, 0).Local()
 	r.Updated = time.Unix(r.UpdatedUnix, 0).Local()
 	return nil
diff --git a/internal/db/two_factor.go b/internal/db/two_factor.go
index ca990454..1c310535 100644
--- a/internal/db/two_factor.go
+++ b/internal/db/two_factor.go
@@ -111,7 +111,7 @@ func (err ErrTwoFactorRecoveryCodeNotFound) Error() string {
 }
 
 // UseRecoveryCode validates recovery code of given user and marks it is used if valid.
-func UseRecoveryCode(userID int64, code string) error {
+func UseRecoveryCode(_ int64, code string) error {
 	recoveryCode := new(TwoFactorRecoveryCode)
 	has, err := x.Where("code = ?", code).And("is_used = ?", false).Get(recoveryCode)
 	if err != nil {
diff --git a/internal/db/two_factors.go b/internal/db/two_factors.go
index 7692e5d5..935f66db 100644
--- a/internal/db/two_factors.go
+++ b/internal/db/two_factors.go
@@ -46,7 +46,7 @@ func (t *TwoFactor) BeforeCreate(tx *gorm.DB) error {
 }
 
 // NOTE: This is a GORM query hook.
-func (t *TwoFactor) AfterFind(tx *gorm.DB) error {
+func (t *TwoFactor) AfterFind(_ *gorm.DB) error {
 	t.Created = time.Unix(t.CreatedUnix, 0).Local()
 	return nil
 }
diff --git a/internal/db/users.go b/internal/db/users.go
index 5e1baf01..ebf2af87 100644
--- a/internal/db/users.go
+++ b/internal/db/users.go
@@ -59,7 +59,7 @@ func (u *User) BeforeCreate(tx *gorm.DB) error {
 }
 
 // NOTE: This is a GORM query hook.
-func (u *User) AfterFind(tx *gorm.DB) error {
+func (u *User) AfterFind(_ *gorm.DB) error {
 	u.Created = time.Unix(u.CreatedUnix, 0).Local()
 	u.Updated = time.Unix(u.UpdatedUnix, 0).Local()
 	return nil
-- 
cgit v1.2.3