mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-07 10:18:08 -06:00
Enable stricter linting with golangci-lint (#316)
* update golangci-lint * add golangci config file w/ more linters * correct issues flagged by stricter linters * add more generous timeout for golangci-lint * add some style + formatting guidelines * move timeout to config file * go fmt
This commit is contained in:
parent
38d73f0316
commit
f8630348b4
47 changed files with 227 additions and 163 deletions
|
|
@ -137,8 +137,7 @@ func (a *accountDB) GetInstanceAccount(ctx context.Context, domain string) (*gts
|
|||
WhereGroup(" AND ", whereEmptyOrNull("domain"))
|
||||
}
|
||||
|
||||
err := q.Scan(ctx)
|
||||
if err != nil {
|
||||
if err := q.Scan(ctx); err != nil {
|
||||
return nil, a.conn.ProcessError(err)
|
||||
}
|
||||
return account, nil
|
||||
|
|
@ -155,8 +154,7 @@ func (a *accountDB) GetAccountLastPosted(ctx context.Context, accountID string)
|
|||
Where("account_id = ?", accountID).
|
||||
Column("created_at")
|
||||
|
||||
err := q.Scan(ctx)
|
||||
if err != nil {
|
||||
if err := q.Scan(ctx); err != nil {
|
||||
return time.Time{}, a.conn.ProcessError(err)
|
||||
}
|
||||
return status.CreatedAt, nil
|
||||
|
|
@ -168,11 +166,12 @@ func (a *accountDB) SetAccountHeaderOrAvatar(ctx context.Context, mediaAttachmen
|
|||
}
|
||||
|
||||
var headerOrAVI string
|
||||
if mediaAttachment.Avatar {
|
||||
switch {
|
||||
case mediaAttachment.Avatar:
|
||||
headerOrAVI = "avatar"
|
||||
} else if mediaAttachment.Header {
|
||||
case mediaAttachment.Header:
|
||||
headerOrAVI = "header"
|
||||
} else {
|
||||
default:
|
||||
return errors.New("given media attachment was neither a header nor an avatar")
|
||||
}
|
||||
|
||||
|
|
@ -202,8 +201,7 @@ func (a *accountDB) GetLocalAccountByUsername(ctx context.Context, username stri
|
|||
Where("username = ?", username).
|
||||
WhereGroup(" AND ", whereEmptyOrNull("domain"))
|
||||
|
||||
err := q.Scan(ctx)
|
||||
if err != nil {
|
||||
if err := q.Scan(ctx); err != nil {
|
||||
return nil, a.conn.ProcessError(err)
|
||||
}
|
||||
return account, nil
|
||||
|
|
@ -308,8 +306,7 @@ func (a *accountDB) GetAccountBlocks(ctx context.Context, accountID string, maxI
|
|||
fq = fq.Limit(limit)
|
||||
}
|
||||
|
||||
err := fq.Scan(ctx)
|
||||
if err != nil {
|
||||
if err := fq.Scan(ctx); err != nil {
|
||||
return nil, "", "", a.conn.ProcessError(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue