autofix: unused parameter should be replaced by underscore (#6799)

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
pull/6801/head
deepsource-autofix[bot] 2022-03-06 15:46:21 +08:00 committed by GitHub
parent ab96a4f0d8
commit 3acc13038d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 24 additions and 26 deletions

View File

@ -11,6 +11,6 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func (c *Config) doAuth(login, password string) error { func (c *Config) doAuth(_, _ string) error {
return errors.New("PAM not supported") return errors.New("PAM not supported")
} }

View File

@ -115,7 +115,7 @@ type smtpLoginAuth struct {
username, password string 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 return "LOGIN", []byte(auth.username), nil
} }

View File

@ -22,7 +22,7 @@ var Cert = cli.Command{
Action: runCert, 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.") fmt.Println("Command cert not available, please use build tags 'cert' to rebuild.")
os.Exit(1) os.Exit(1)

View File

@ -39,7 +39,7 @@ func TestIsProdMode(t *testing.T) {
} }
} }
func TestWorkDirHelper(t *testing.T) { func TestWorkDirHelper(_ *testing.T) {
if !testutil.WantHelperProcess() { if !testutil.WantHelperProcess() {
return return
} }
@ -67,7 +67,7 @@ func TestWorkDir(t *testing.T) {
} }
} }
func TestCustomDirHelper(t *testing.T) { func TestCustomDirHelper(_ *testing.T) {
if !testutil.WantHelperProcess() { if !testutil.WantHelperProcess() {
return return
} }
@ -95,7 +95,7 @@ func TestCustomDir(t *testing.T) {
} }
} }
func TestHomeDirHelper(t *testing.T) { func TestHomeDirHelper(_ *testing.T) {
if !testutil.WantHelperProcess() { if !testutil.WantHelperProcess() {
return return
} }

View File

@ -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 // Make sure it does not blow up
MustAsset("conf/app.ini") MustAsset("conf/app.ini")
} }

View File

@ -175,7 +175,7 @@ func (a *Action) GetIssueContent() string {
return issue.Content 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 opType := ACTION_CREATE_REPO
if repo.IsFork { if repo.IsFork {
opType = ACTION_FORK_REPO opType = ACTION_FORK_REPO

View File

@ -66,7 +66,7 @@ type LoginSource struct {
} }
// NOTE: This is a GORM save hook. // 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 { if s.Provider == nil {
return nil return nil
} }
@ -90,7 +90,7 @@ func (s *LoginSource) BeforeUpdate(tx *gorm.DB) error {
} }
// NOTE: This is a GORM query hook. // 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.Created = time.Unix(s.CreatedUnix, 0).Local()
s.Updated = time.Unix(s.UpdatedUnix, 0).Local() s.Updated = time.Unix(s.UpdatedUnix, 0).Local()

View File

@ -1746,7 +1746,7 @@ func GetUserAndCollaborativeRepositories(userID int64) ([]*Repository, error) {
return append(repos, ownRepos...), nil 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}) return x.Count(&Repository{OwnerID: u.ID})
} }

View File

@ -40,7 +40,7 @@ func (r *Repository) BeforeUpdate(tx *gorm.DB) error {
} }
// NOTE: This is a GORM query hook. // 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.Created = time.Unix(r.CreatedUnix, 0).Local()
r.Updated = time.Unix(r.UpdatedUnix, 0).Local() r.Updated = time.Unix(r.UpdatedUnix, 0).Local()
return nil return nil

View File

@ -111,7 +111,7 @@ func (err ErrTwoFactorRecoveryCodeNotFound) Error() string {
} }
// UseRecoveryCode validates recovery code of given user and marks it is used if valid. // 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) recoveryCode := new(TwoFactorRecoveryCode)
has, err := x.Where("code = ?", code).And("is_used = ?", false).Get(recoveryCode) has, err := x.Where("code = ?", code).And("is_used = ?", false).Get(recoveryCode)
if err != nil { if err != nil {

View File

@ -46,7 +46,7 @@ func (t *TwoFactor) BeforeCreate(tx *gorm.DB) error {
} }
// NOTE: This is a GORM query hook. // 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() t.Created = time.Unix(t.CreatedUnix, 0).Local()
return nil return nil
} }

View File

@ -59,7 +59,7 @@ func (u *User) BeforeCreate(tx *gorm.DB) error {
} }
// NOTE: This is a GORM query hook. // 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.Created = time.Unix(u.CreatedUnix, 0).Local()
u.Updated = time.Unix(u.UpdatedUnix, 0).Local() u.Updated = time.Unix(u.UpdatedUnix, 0).Local()
return nil return nil

View File

@ -102,7 +102,7 @@ type Issue interface {
HTMLURL() string 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{}{ data := map[string]interface{}{
"Username": u.DisplayName(), "Username": u.DisplayName(),
"ActiveCodeLives": conf.Auth.ActivateCodeLives / 60, "ActiveCodeLives": conf.Auth.ActivateCodeLives / 60,

View File

@ -77,7 +77,7 @@ func LoginAuth(username, password string) smtp.Auth {
return &loginAuth{username, password} 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 return "LOGIN", []byte{}, nil
} }
@ -95,8 +95,7 @@ func (a *loginAuth) Next(fromServer []byte, more bool) ([]byte, error) {
return nil, nil return nil, nil
} }
type Sender struct { type Sender struct{}
}
func (s *Sender) Send(from string, to []string, msg io.WriterTo) error { func (s *Sender) Send(from string, to []string, msg io.WriterTo) error {
opts := conf.Email opts := conf.Email

View File

@ -122,7 +122,7 @@ func RenderIssueIndexPattern(rawBytes []byte, urlPrefix string, metas map[string
var pound = []byte("#") var pound = []byte("#")
// RenderCrossReferenceIssueIndexPattern renders issue indexes from other repositories to corresponding links. // 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) ms := CrossReferenceIssueNumericPattern.FindAll(rawBytes, -1)
for _, m := range ms { for _, m := range ms {
if m[0] == ' ' || m[0] == '(' { if m[0] == ' ' || m[0] == '(' {

View File

@ -31,12 +31,12 @@ func (s *mockStorage) Storage() lfsutil.Storage {
return "memory" 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() defer rc.Close()
return io.Copy(s.buf, rc) 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) _, err := io.Copy(w, s.buf)
return err return err
} }

View File

@ -35,7 +35,7 @@ func RefCommits(c *context.Context) {
} }
// TODO(unknwon) // TODO(unknwon)
func RenderIssueLinks(oldCommits []*git.Commit, repoLink string) []*git.Commit { func RenderIssueLinks(oldCommits []*git.Commit, _ string) []*git.Commit {
return oldCommits return oldCommits
} }

View File

@ -99,8 +99,7 @@ func Following(c *context.Context, puser *context.ParamsUser) {
repo.RenderUserCards(c, puser.NumFollowing, puser.GetFollowing, FOLLOWERS) 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) { func Action(c *context.Context, puser *context.ParamsUser) {

View File

@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
func TestExecHelper(t *testing.T) { func TestExecHelper(_ *testing.T) {
if !WantHelperProcess() { if !WantHelperProcess() {
return return
} }