diff options
author | deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> | 2022-03-06 15:46:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-06 15:46:21 +0800 |
commit | 3acc13038dfe5e0643112140d329c6eb0ed4cd6a (patch) | |
tree | 7205f5757e00f509670cbd61e7b01dfaf8092f11 /internal | |
parent | ab96a4f0d840987797e79ec7e3a4b02a7b6880e7 (diff) |
autofix: unused parameter should be replaced by underscore (#6799)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal')
-rw-r--r-- | internal/auth/pam/pam_stub.go | 2 | ||||
-rw-r--r-- | internal/auth/smtp/provider.go | 2 | ||||
-rw-r--r-- | internal/cmd/cert_stub.go | 2 | ||||
-rw-r--r-- | internal/conf/computed_test.go | 6 | ||||
-rw-r--r-- | internal/conf/conf_test.go | 2 | ||||
-rw-r--r-- | internal/db/action.go | 2 | ||||
-rw-r--r-- | internal/db/login_sources.go | 4 | ||||
-rw-r--r-- | internal/db/repo.go | 2 | ||||
-rw-r--r-- | internal/db/repos.go | 2 | ||||
-rw-r--r-- | internal/db/two_factor.go | 2 | ||||
-rw-r--r-- | internal/db/two_factors.go | 2 | ||||
-rw-r--r-- | internal/db/users.go | 2 | ||||
-rw-r--r-- | internal/email/email.go | 2 | ||||
-rw-r--r-- | internal/email/message.go | 5 | ||||
-rw-r--r-- | internal/markup/markup.go | 2 | ||||
-rw-r--r-- | internal/route/lfs/basic_test.go | 4 | ||||
-rw-r--r-- | internal/route/repo/commit.go | 2 | ||||
-rw-r--r-- | internal/route/user/profile.go | 3 | ||||
-rw-r--r-- | internal/testutil/exec_test.go | 2 |
19 files changed, 24 insertions, 26 deletions
diff --git a/internal/auth/pam/pam_stub.go b/internal/auth/pam/pam_stub.go index 65777fd2..a9da5de6 100644 --- a/internal/auth/pam/pam_stub.go +++ b/internal/auth/pam/pam_stub.go @@ -11,6 +11,6 @@ import ( "github.com/pkg/errors" ) -func (c *Config) doAuth(login, password string) error { +func (c *Config) doAuth(_, _ string) error { return errors.New("PAM not supported") } diff --git a/internal/auth/smtp/provider.go b/internal/auth/smtp/provider.go index 3e39aa22..1a136f0e 100644 --- a/internal/auth/smtp/provider.go +++ b/internal/auth/smtp/provider.go @@ -115,7 +115,7 @@ type smtpLoginAuth struct { username, password string } -func (auth *smtpLoginAuth) Start(server *smtp.ServerInfo) (string, []byte, error) { +func (auth *smtpLoginAuth) Start(_ *smtp.ServerInfo) (string, []byte, error) { return "LOGIN", []byte(auth.username), nil } diff --git a/internal/cmd/cert_stub.go b/internal/cmd/cert_stub.go index ddeb92b0..fff99e3f 100644 --- a/internal/cmd/cert_stub.go +++ b/internal/cmd/cert_stub.go @@ -22,7 +22,7 @@ var Cert = cli.Command{ Action: runCert, } -func runCert(ctx *cli.Context) error { +func runCert(_ *cli.Context) error { fmt.Println("Command cert not available, please use build tags 'cert' to rebuild.") os.Exit(1) diff --git a/internal/conf/computed_test.go b/internal/conf/computed_test.go index 908b7679..8ed49a53 100644 --- a/internal/conf/computed_test.go +++ b/internal/conf/computed_test.go @@ -39,7 +39,7 @@ func TestIsProdMode(t *testing.T) { } } -func TestWorkDirHelper(t *testing.T) { +func TestWorkDirHelper(_ *testing.T) { if !testutil.WantHelperProcess() { return } @@ -67,7 +67,7 @@ func TestWorkDir(t *testing.T) { } } -func TestCustomDirHelper(t *testing.T) { +func TestCustomDirHelper(_ *testing.T) { if !testutil.WantHelperProcess() { return } @@ -95,7 +95,7 @@ func TestCustomDir(t *testing.T) { } } -func TestHomeDirHelper(t *testing.T) { +func TestHomeDirHelper(_ *testing.T) { if !testutil.WantHelperProcess() { return } diff --git a/internal/conf/conf_test.go b/internal/conf/conf_test.go index 51ccf93c..c5159bed 100644 --- a/internal/conf/conf_test.go +++ b/internal/conf/conf_test.go @@ -31,7 +31,7 @@ func TestAssetDir(t *testing.T) { } } -func TestMustAsset(t *testing.T) { +func TestMustAsset(_ *testing.T) { // Make sure it does not blow up MustAsset("conf/app.ini") } 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 diff --git a/internal/email/email.go b/internal/email/email.go index 917e6665..81b772ea 100644 --- a/internal/email/email.go +++ b/internal/email/email.go @@ -102,7 +102,7 @@ type Issue interface { HTMLURL() string } -func SendUserMail(c *macaron.Context, u User, tpl, code, subject, info string) { +func SendUserMail(_ *macaron.Context, u User, tpl, code, subject, info string) { data := map[string]interface{}{ "Username": u.DisplayName(), "ActiveCodeLives": conf.Auth.ActivateCodeLives / 60, diff --git a/internal/email/message.go b/internal/email/message.go index ec4f7cc1..587db161 100644 --- a/internal/email/message.go +++ b/internal/email/message.go @@ -77,7 +77,7 @@ func LoginAuth(username, password string) smtp.Auth { return &loginAuth{username, password} } -func (a *loginAuth) Start(server *smtp.ServerInfo) (string, []byte, error) { +func (a *loginAuth) Start(_ *smtp.ServerInfo) (string, []byte, error) { return "LOGIN", []byte{}, nil } @@ -95,8 +95,7 @@ func (a *loginAuth) Next(fromServer []byte, more bool) ([]byte, error) { return nil, nil } -type Sender struct { -} +type Sender struct{} func (s *Sender) Send(from string, to []string, msg io.WriterTo) error { opts := conf.Email diff --git a/internal/markup/markup.go b/internal/markup/markup.go index d4784ff6..3f2a1172 100644 --- a/internal/markup/markup.go +++ b/internal/markup/markup.go @@ -122,7 +122,7 @@ func RenderIssueIndexPattern(rawBytes []byte, urlPrefix string, metas map[string var pound = []byte("#") // RenderCrossReferenceIssueIndexPattern renders issue indexes from other repositories to corresponding links. -func RenderCrossReferenceIssueIndexPattern(rawBytes []byte, urlPrefix string, metas map[string]string) []byte { +func RenderCrossReferenceIssueIndexPattern(rawBytes []byte, _ string, _ map[string]string) []byte { ms := CrossReferenceIssueNumericPattern.FindAll(rawBytes, -1) for _, m := range ms { if m[0] == ' ' || m[0] == '(' { diff --git a/internal/route/lfs/basic_test.go b/internal/route/lfs/basic_test.go index db2fbe61..f874f536 100644 --- a/internal/route/lfs/basic_test.go +++ b/internal/route/lfs/basic_test.go @@ -31,12 +31,12 @@ func (s *mockStorage) Storage() lfsutil.Storage { return "memory" } -func (s *mockStorage) Upload(oid lfsutil.OID, rc io.ReadCloser) (int64, error) { +func (s *mockStorage) Upload(_ lfsutil.OID, rc io.ReadCloser) (int64, error) { defer rc.Close() return io.Copy(s.buf, rc) } -func (s *mockStorage) Download(oid lfsutil.OID, w io.Writer) error { +func (s *mockStorage) Download(_ lfsutil.OID, w io.Writer) error { _, err := io.Copy(w, s.buf) return err } diff --git a/internal/route/repo/commit.go b/internal/route/repo/commit.go index a8a344bd..ae424d06 100644 --- a/internal/route/repo/commit.go +++ b/internal/route/repo/commit.go @@ -35,7 +35,7 @@ func RefCommits(c *context.Context) { } // TODO(unknwon) -func RenderIssueLinks(oldCommits []*git.Commit, repoLink string) []*git.Commit { +func RenderIssueLinks(oldCommits []*git.Commit, _ string) []*git.Commit { return oldCommits } diff --git a/internal/route/user/profile.go b/internal/route/user/profile.go index 89d84509..3baee4e3 100644 --- a/internal/route/user/profile.go +++ b/internal/route/user/profile.go @@ -99,8 +99,7 @@ func Following(c *context.Context, puser *context.ParamsUser) { repo.RenderUserCards(c, puser.NumFollowing, puser.GetFollowing, FOLLOWERS) } -func Stars(c *context.Context) { - +func Stars(_ *context.Context) { } func Action(c *context.Context, puser *context.ParamsUser) { diff --git a/internal/testutil/exec_test.go b/internal/testutil/exec_test.go index 679dc9d0..c740c41e 100644 --- a/internal/testutil/exec_test.go +++ b/internal/testutil/exec_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestExecHelper(t *testing.T) { +func TestExecHelper(_ *testing.T) { if !WantHelperProcess() { return } |