mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-27 10:51:00 +00:00
[chore] Update versions, fix lint errors (#1860)
This commit is contained in:
parent
1d4137fb88
commit
21c1552daa
12 changed files with 66 additions and 57 deletions
18
.drone.yml
18
.drone.yml
|
@ -12,7 +12,7 @@ steps:
|
|||
# We use golangci-lint for linting.
|
||||
# See: https://golangci-lint.run/
|
||||
- name: lint
|
||||
image: golangci/golangci-lint:v1.51.2
|
||||
image: golangci/golangci-lint:v1.53.1
|
||||
volumes:
|
||||
- name: go-build-cache
|
||||
path: /root/.cache/go-build
|
||||
|
@ -28,7 +28,7 @@ steps:
|
|||
- pull_request
|
||||
|
||||
- name: test
|
||||
image: golang:1.20.1-alpine
|
||||
image: golang:1.20.4-alpine
|
||||
volumes:
|
||||
- name: go-build-cache
|
||||
path: /root/.cache/go-build
|
||||
|
@ -44,7 +44,7 @@ steps:
|
|||
- pull_request
|
||||
|
||||
- name: web-setup
|
||||
image: node:14-alpine
|
||||
image: node:18-alpine
|
||||
when:
|
||||
event:
|
||||
include:
|
||||
|
@ -57,7 +57,7 @@ steps:
|
|||
- yarn --frozen-lockfile --cache-folder /tmp/cache
|
||||
|
||||
- name: web-lint
|
||||
image: node:14-alpine
|
||||
image: node:18-alpine
|
||||
when:
|
||||
event:
|
||||
include:
|
||||
|
@ -69,7 +69,7 @@ steps:
|
|||
- yarn run lint
|
||||
|
||||
- name: web-build
|
||||
image: node:14-alpine
|
||||
image: node:18-alpine
|
||||
when:
|
||||
event:
|
||||
include:
|
||||
|
@ -81,7 +81,7 @@ steps:
|
|||
- yarn run build
|
||||
|
||||
- name: snapshot
|
||||
image: superseriousbusiness/gotosocial-drone-build:0.1.0 # https://github.com/superseriousbusiness/gotosocial-drone-build
|
||||
image: superseriousbusiness/gotosocial-drone-build:0.2.0 # https://github.com/superseriousbusiness/gotosocial-drone-build
|
||||
volumes:
|
||||
- name: go-build-cache
|
||||
path: /root/.cache/go-build
|
||||
|
@ -110,7 +110,7 @@ steps:
|
|||
- main
|
||||
|
||||
- name: release
|
||||
image: superseriousbusiness/gotosocial-drone-build:0.1.0 # https://github.com/superseriousbusiness/gotosocial-drone-build
|
||||
image: superseriousbusiness/gotosocial-drone-build:0.2.0 # https://github.com/superseriousbusiness/gotosocial-drone-build
|
||||
volumes:
|
||||
- name: go-build-cache
|
||||
path: /root/.cache/go-build
|
||||
|
@ -169,7 +169,7 @@ clone:
|
|||
|
||||
steps:
|
||||
- name: mirror
|
||||
image: superseriousbusiness/gotosocial-drone-build:0.1.0
|
||||
image: superseriousbusiness/gotosocial-drone-build:0.2.0
|
||||
environment:
|
||||
ORIGIN_REPO: https://github.com/superseriousbusiness/gotosocial
|
||||
TARGET_REPO: https://codeberg.org/superseriousbusiness/gotosocial
|
||||
|
@ -182,6 +182,6 @@ steps:
|
|||
|
||||
---
|
||||
kind: signature
|
||||
hmac: b894a72d5912045f74b9c046c7ecd49f2d36bead2a139d85af66a441aa2bc435
|
||||
hmac: 946c2ffd4e79de07a767ec06ebac0a8ca70a03ce5666aae093c9b0af455041d1
|
||||
|
||||
...
|
||||
|
|
|
@ -23,7 +23,9 @@ linters:
|
|||
- nilerr
|
||||
- revive
|
||||
|
||||
# https://golangci-lint.run/usage/linters/#linters-configuration
|
||||
linters-settings:
|
||||
# https://golangci-lint.run/usage/linters/#goheader
|
||||
goheader:
|
||||
template: |-
|
||||
GoToSocial
|
||||
|
@ -42,11 +44,44 @@ linters-settings:
|
|||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# https://golangci-lint.run/usage/linters/#govet
|
||||
govet:
|
||||
disable:
|
||||
- composites
|
||||
# https://golangci-lint.run/usage/linters/#revive
|
||||
revive:
|
||||
rules:
|
||||
# Enable most default rules.
|
||||
# See: https://github.com/mgechev/revive/blob/master/defaults.toml
|
||||
- name: blank-imports
|
||||
- name: context-as-argument
|
||||
- name: context-keys-type
|
||||
- name: dot-imports
|
||||
- name: error-naming
|
||||
- name: error-return
|
||||
- name: error-strings
|
||||
- name: exported
|
||||
- name: if-return
|
||||
- name: increment-decrement
|
||||
- name: var-naming
|
||||
- name: var-declaration
|
||||
- name: package-comments
|
||||
- name: range
|
||||
- name: receiver-naming
|
||||
- name: time-naming
|
||||
- name: unexported-return
|
||||
- name: indent-error-flow
|
||||
- name: errorf
|
||||
- name: empty-block
|
||||
- name: superfluous-else
|
||||
- name: unreachable-code
|
||||
# Disable below rules.
|
||||
- name: redefines-builtin-id
|
||||
disabled: true # This one is just annoying.
|
||||
- name: unused-parameter
|
||||
disabled: true # We often pass parameters to fulfil interfaces.
|
||||
# https://golangci-lint.run/usage/linters/#staticcheck
|
||||
staticcheck:
|
||||
# Enable all checks
|
||||
# Disable:
|
||||
# - SA1012: nil context passing
|
||||
# Enable all checks, but disable SA1012: nil context passing.
|
||||
# See: https://staticcheck.io/docs/configuration/options/#checks
|
||||
checks: ["all", "-SA1012"]
|
||||
|
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -3,6 +3,9 @@
|
|||
"go.lintFlags": [
|
||||
"--fast"
|
||||
],
|
||||
"go.vetFlags": [
|
||||
"-composites=false ."
|
||||
],
|
||||
"eslint.workingDirectories": ["web/source"],
|
||||
"eslint.lintTask.enable": true,
|
||||
"eslint.lintTask.options": "${workspaceFolder}/web/source"
|
||||
|
|
|
@ -353,9 +353,5 @@ var Password action.GTSAction = func(ctx context.Context) error {
|
|||
}
|
||||
|
||||
u.EncryptedPassword = string(pw)
|
||||
if err := dbConn.UpdateUser(ctx, u, "encrypted_password"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return dbConn.UpdateUser(ctx, u, "encrypted_password")
|
||||
}
|
||||
|
|
|
@ -141,9 +141,5 @@ func validateCreateAccount(form *apimodel.AccountCreateRequest) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := validate.SignUpReason(form.Reason, config.GetAccountsReasonRequired()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return validate.SignUpReason(form.Reason, config.GetAccountsReasonRequired())
|
||||
}
|
||||
|
|
|
@ -117,7 +117,8 @@ func ErrorHandler(c *gin.Context, errWithCode gtserror.WithCode, instanceGet fun
|
|||
// or if we should just use a json. Normally we would want to
|
||||
// check for a returned error, but if an error occurs here we
|
||||
// can just fall back to default behavior (serve json error).
|
||||
accept, _ := NegotiateAccept(c, JSONOrHTMLAcceptHeaders...)
|
||||
// Prefer provided offers, fall back to JSON or HTML.
|
||||
accept, _ := NegotiateAccept(c, append(offers, JSONOrHTMLAcceptHeaders...)...)
|
||||
|
||||
if errWithCode.Code() == http.StatusNotFound {
|
||||
// Use our special not found handler with useful status text.
|
||||
|
|
1
internal/cache/util.go
vendored
1
internal/cache/util.go
vendored
|
@ -36,6 +36,7 @@ var SentinelError = errors.New("BUG: error should not be returned") //nolint:rev
|
|||
// caches, which specifically catches and ignores our sentinel error type.
|
||||
func ignoreErrors(err error) bool {
|
||||
return errorsv2.Comparable(
|
||||
err,
|
||||
SentinelError,
|
||||
context.DeadlineExceeded,
|
||||
context.Canceled,
|
||||
|
|
|
@ -160,7 +160,7 @@ func (b *basicDB) DropTable(ctx context.Context, i interface{}) db.Error {
|
|||
}
|
||||
|
||||
func (b *basicDB) IsHealthy(ctx context.Context) db.Error {
|
||||
return b.conn.Ping()
|
||||
return b.conn.PingContext(ctx)
|
||||
}
|
||||
|
||||
func (b *basicDB) Stop(ctx context.Context) db.Error {
|
||||
|
|
|
@ -70,11 +70,7 @@ func (f *federatingDB) Reject(ctx context.Context, reject vocab.ActivityStreamsR
|
|||
return errors.New("Reject: follow object account and inbox account were not the same")
|
||||
}
|
||||
|
||||
if err := f.state.DB.RejectFollowRequest(ctx, followReq.AccountID, followReq.TargetAccountID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return f.state.DB.RejectFollowRequest(ctx, followReq.AccountID, followReq.TargetAccountID)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,20 +86,19 @@ func (f *federatingDB) Reject(ctx context.Context, reject vocab.ActivityStreamsR
|
|||
if !ok {
|
||||
return errors.New("Reject: couldn't parse follow into vocab.ActivityStreamsFollow")
|
||||
}
|
||||
|
||||
// convert the follow to something we can understand
|
||||
gtsFollow, err := f.typeConverter.ASFollowToFollow(ctx, asFollow)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Reject: error converting asfollow to gtsfollow: %s", err)
|
||||
}
|
||||
|
||||
// make sure the addressee of the original follow is the same as whatever inbox this landed in
|
||||
if gtsFollow.AccountID != receivingAccount.ID {
|
||||
return errors.New("Reject: follow object account and inbox account were not the same")
|
||||
}
|
||||
if err := f.state.DB.RejectFollowRequest(ctx, gtsFollow.AccountID, gtsFollow.TargetAccountID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return f.state.DB.RejectFollowRequest(ctx, gtsFollow.AccountID, gtsFollow.TargetAccountID)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,8 +72,6 @@ func (gts *gotosocial) Stop(ctx context.Context) error {
|
|||
if err := gts.apiRouter.Stop(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gts.db.Stop(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
return gts.db.Stop(ctx)
|
||||
}
|
||||
|
|
|
@ -434,11 +434,7 @@ func (p *Processor) wipeStatus(ctx context.Context, statusToDelete *gtsmodel.Sta
|
|||
}
|
||||
|
||||
// delete the status itself
|
||||
if err := p.state.DB.DeleteStatusByID(ctx, statusToDelete.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return p.state.DB.DeleteStatusByID(ctx, statusToDelete.ID)
|
||||
}
|
||||
|
||||
// deleteStatusFromTimelines completely removes the given status from all timelines.
|
||||
|
|
|
@ -167,11 +167,7 @@ func (p *Processor) processCreateStatusFromFederator(ctx context.Context, federa
|
|||
}
|
||||
}
|
||||
|
||||
if err := p.timelineAndNotifyStatus(ctx, status); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return p.timelineAndNotifyStatus(ctx, status)
|
||||
}
|
||||
|
||||
// processCreateFaveFromFederator handles Activity Create and Object Like
|
||||
|
@ -208,11 +204,7 @@ func (p *Processor) processCreateFaveFromFederator(ctx context.Context, federato
|
|||
incomingFave.Account = a
|
||||
}
|
||||
|
||||
if err := p.notifyFave(ctx, incomingFave); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return p.notifyFave(ctx, incomingFave)
|
||||
}
|
||||
|
||||
// processCreateFollowRequestFromFederator handles Activity Create and Object Follow
|
||||
|
@ -327,11 +319,7 @@ func (p *Processor) processCreateAnnounceFromFederator(ctx context.Context, fede
|
|||
return err
|
||||
}
|
||||
|
||||
if err := p.notifyAnnounce(ctx, incomingAnnounce); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return p.notifyAnnounce(ctx, incomingAnnounce)
|
||||
}
|
||||
|
||||
// processCreateBlockFromFederator handles Activity Create and Object Block
|
||||
|
|
Loading…
Reference in a new issue