Skip to content

Commit 887a683

Browse files
silverwind6543wxiaoguang
authored
Update tool dependencies, lock govulncheck and actionlint (#25655)
- Update all tool dependencies - Lock `govulncheck` and `actionlint` to their latest tags --------- Co-authored-by: 6543 <[email protected]> Co-authored-by: 6543 <[email protected]> Co-authored-by: wxiaoguang <[email protected]>
1 parent 115f40e commit 887a683

26 files changed

+133
-141
lines changed

.golangci.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,21 @@ linters-settings:
7777
extra-rules: true
7878
lang-version: "1.20"
7979
depguard:
80-
list-type: denylist
81-
# Check the list against standard lib.
82-
include-go-root: true
83-
packages-with-error-message:
84-
- encoding/json: "use gitea's modules/json instead of encoding/json"
85-
- github.com/unknwon/com: "use gitea's util and replacements"
86-
- io/ioutil: "use os or io instead"
87-
- golang.org/x/exp: "it's experimental and unreliable."
88-
- code.gitea.io/gitea/modules/git/internal: "do not use the internal package, use AddXxx function instead"
89-
- gopkg.in/ini.v1: "do not use the ini package, use gitea's config system instead"
80+
rules:
81+
main:
82+
deny:
83+
- pkg: encoding/json
84+
desc: use gitea's modules/json instead of encoding/json
85+
- pkg: github.com/unknwon/com
86+
desc: use gitea's util and replacements
87+
- pkg: io/ioutil
88+
desc: use os or io instead
89+
- pkg: golang.org/x/exp
90+
desc: it's experimental and unreliable
91+
- pkg: code.gitea.io/gitea/modules/git/internal
92+
desc: do not use the internal package, use AddXxx function instead
93+
- pkg: gopkg.in/ini.v1
94+
desc: do not use the ini package, use gitea's config system instead
9095

9196
issues:
9297
max-issues-per-linter: 0

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ COMMA := ,
2525

2626
XGO_VERSION := go-1.20.x
2727

28-
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.43.0
28+
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.44.0
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/[email protected]
3030
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
31-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
31+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3
3232
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3333
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/[email protected]
34-
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected].4
34+
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected].5
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3636
GO_LICENSES_PACKAGE ?= github.com/google/[email protected]
37-
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@latest
38-
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@latest
37+
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v0.2.0
38+
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1.6.25
3939

4040
DOCKER_IMAGE ?= gitea/gitea
4141
DOCKER_TAG ?= latest

models/activities/notification.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func getIssueNotification(ctx context.Context, userID, issueID int64) (*Notifica
343343
// NotificationsForUser returns notifications for a given user and status
344344
func NotificationsForUser(ctx context.Context, user *user_model.User, statuses []NotificationStatus, page, perPage int) (notifications NotificationList, err error) {
345345
if len(statuses) == 0 {
346-
return
346+
return nil, nil
347347
}
348348

349349
sess := db.GetEngine(ctx).
@@ -372,16 +372,16 @@ func CountUnread(ctx context.Context, userID int64) int64 {
372372
// LoadAttributes load Repo Issue User and Comment if not loaded
373373
func (n *Notification) LoadAttributes(ctx context.Context) (err error) {
374374
if err = n.loadRepo(ctx); err != nil {
375-
return
375+
return err
376376
}
377377
if err = n.loadIssue(ctx); err != nil {
378-
return
378+
return err
379379
}
380380
if err = n.loadUser(ctx); err != nil {
381-
return
381+
return err
382382
}
383383
if err = n.loadComment(ctx); err != nil {
384-
return
384+
return err
385385
}
386386
return err
387387
}

models/asymkey/gpg_key_common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func populateHash(hashFunc crypto.Hash, msg []byte) (hash.Hash, error) {
111111
func readArmoredSign(r io.Reader) (body io.Reader, err error) {
112112
block, err := armor.Decode(r)
113113
if err != nil {
114-
return
114+
return nil, err
115115
}
116116
if block.Type != openpgp.SignatureType {
117117
return nil, fmt.Errorf("expected '" + openpgp.SignatureType + "', got: " + block.Type)

models/issues/comment.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ func (c *Comment) LoadPushCommits(ctx context.Context) (err error) {
749749

750750
err = json.Unmarshal([]byte(c.Content), &data)
751751
if err != nil {
752-
return
752+
return err
753753
}
754754

755755
c.IsForcePush = data.IsForcePush
@@ -925,7 +925,7 @@ func createIssueDependencyComment(ctx context.Context, doer *user_model.User, is
925925
cType = CommentTypeRemoveDependency
926926
}
927927
if err = issue.LoadRepo(ctx); err != nil {
928-
return
928+
return err
929929
}
930930

931931
// Make two comments, one in each issue
@@ -937,7 +937,7 @@ func createIssueDependencyComment(ctx context.Context, doer *user_model.User, is
937937
DependentIssueID: dependentIssue.ID,
938938
}
939939
if _, err = CreateComment(ctx, opts); err != nil {
940-
return
940+
return err
941941
}
942942

943943
opts = &CreateCommentOptions{
@@ -1170,11 +1170,11 @@ func CreateAutoMergeComment(ctx context.Context, typ CommentType, pr *PullReques
11701170
return nil, fmt.Errorf("comment type %d cannot be used to create an auto merge comment", typ)
11711171
}
11721172
if err = pr.LoadIssue(ctx); err != nil {
1173-
return
1173+
return nil, err
11741174
}
11751175

11761176
if err = pr.LoadBaseRepo(ctx); err != nil {
1177-
return
1177+
return nil, err
11781178
}
11791179

11801180
comment, err = CreateComment(ctx, &CreateCommentOptions{

models/issues/comment_list.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -468,42 +468,38 @@ func (comments CommentList) loadReviews(ctx context.Context) error {
468468
// loadAttributes loads all attributes
469469
func (comments CommentList) loadAttributes(ctx context.Context) (err error) {
470470
if err = comments.LoadPosters(ctx); err != nil {
471-
return
471+
return err
472472
}
473473

474474
if err = comments.loadLabels(ctx); err != nil {
475-
return
475+
return err
476476
}
477477

478478
if err = comments.loadMilestones(ctx); err != nil {
479-
return
479+
return err
480480
}
481481

482482
if err = comments.loadOldMilestones(ctx); err != nil {
483-
return
483+
return err
484484
}
485485

486486
if err = comments.loadAssignees(ctx); err != nil {
487-
return
487+
return err
488488
}
489489

490490
if err = comments.LoadAttachments(ctx); err != nil {
491-
return
491+
return err
492492
}
493493

494494
if err = comments.loadReviews(ctx); err != nil {
495-
return
495+
return err
496496
}
497497

498498
if err = comments.LoadIssues(ctx); err != nil {
499-
return
500-
}
501-
502-
if err = comments.loadDependentIssues(ctx); err != nil {
503-
return
499+
return err
504500
}
505501

506-
return nil
502+
return comments.loadDependentIssues(ctx)
507503
}
508504

509505
// LoadAttributes loads attributes of the comments, except for attachments and

models/issues/issue.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ func (issue *Issue) LoadPoster(ctx context.Context) (err error) {
222222
if !user_model.IsErrUserNotExist(err) {
223223
return fmt.Errorf("getUserByID.(poster) [%d]: %w", issue.PosterID, err)
224224
}
225-
err = nil
226-
return
225+
return nil
227226
}
228227
}
229228
return err
@@ -316,27 +315,27 @@ func (issue *Issue) LoadMilestone(ctx context.Context) (err error) {
316315
// LoadAttributes loads the attribute of this issue.
317316
func (issue *Issue) LoadAttributes(ctx context.Context) (err error) {
318317
if err = issue.LoadRepo(ctx); err != nil {
319-
return
318+
return err
320319
}
321320

322321
if err = issue.LoadPoster(ctx); err != nil {
323-
return
322+
return err
324323
}
325324

326325
if err = issue.LoadLabels(ctx); err != nil {
327-
return
326+
return err
328327
}
329328

330329
if err = issue.LoadMilestone(ctx); err != nil {
331-
return
330+
return err
332331
}
333332

334333
if err = issue.LoadProject(ctx); err != nil {
335-
return
334+
return err
336335
}
337336

338337
if err = issue.LoadAssignees(ctx); err != nil {
339-
return
338+
return err
340339
}
341340

342341
if err = issue.LoadPullRequest(ctx); err != nil && !IsErrPullRequestNotExist(err) {

models/issues/issue_label.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func newIssueLabel(ctx context.Context, issue *Issue, label *Label, doer *user_m
3939
}
4040

4141
if err = issue.LoadRepo(ctx); err != nil {
42-
return
42+
return err
4343
}
4444

4545
opts := &CreateCommentOptions{
@@ -168,7 +168,7 @@ func deleteIssueLabel(ctx context.Context, issue *Issue, label *Label, doer *use
168168
}
169169

170170
if err = issue.LoadRepo(ctx); err != nil {
171-
return
171+
return err
172172
}
173173

174174
opts := &CreateCommentOptions{

models/issues/issue_update.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -538,10 +538,10 @@ func FindAndUpdateIssueMentions(ctx context.Context, issue *Issue, doer *user_mo
538538
// don't have access to reading it. Teams are expanded into their users, but organizations are ignored.
539539
func ResolveIssueMentionsByVisibility(ctx context.Context, issue *Issue, doer *user_model.User, mentions []string) (users []*user_model.User, err error) {
540540
if len(mentions) == 0 {
541-
return
541+
return nil, nil
542542
}
543543
if err = issue.LoadRepo(ctx); err != nil {
544-
return
544+
return nil, err
545545
}
546546

547547
resolved := make(map[string]bool, 10)
@@ -635,7 +635,7 @@ func ResolveIssueMentionsByVisibility(ctx context.Context, issue *Issue, doer *u
635635
}
636636
}
637637
if len(mentionUsers) == 0 {
638-
return
638+
return users, err
639639
}
640640

641641
if users == nil {
@@ -702,66 +702,66 @@ func DeleteIssuesByRepoID(ctx context.Context, repoID int64) (attachmentPaths []
702702
// Delete content histories
703703
if _, err = sess.In("issue_id", deleteCond).
704704
Delete(&ContentHistory{}); err != nil {
705-
return
705+
return nil, err
706706
}
707707

708708
// Delete comments and attachments
709709
if _, err = sess.In("issue_id", deleteCond).
710710
Delete(&Comment{}); err != nil {
711-
return
711+
return nil, err
712712
}
713713

714714
// Dependencies for issues in this repository
715715
if _, err = sess.In("issue_id", deleteCond).
716716
Delete(&IssueDependency{}); err != nil {
717-
return
717+
return nil, err
718718
}
719719

720720
// Delete dependencies for issues in other repositories
721721
if _, err = sess.In("dependency_id", deleteCond).
722722
Delete(&IssueDependency{}); err != nil {
723-
return
723+
return nil, err
724724
}
725725

726726
if _, err = sess.In("issue_id", deleteCond).
727727
Delete(&IssueUser{}); err != nil {
728-
return
728+
return nil, err
729729
}
730730

731731
if _, err = sess.In("issue_id", deleteCond).
732732
Delete(&Reaction{}); err != nil {
733-
return
733+
return nil, err
734734
}
735735

736736
if _, err = sess.In("issue_id", deleteCond).
737737
Delete(&IssueWatch{}); err != nil {
738-
return
738+
return nil, err
739739
}
740740

741741
if _, err = sess.In("issue_id", deleteCond).
742742
Delete(&Stopwatch{}); err != nil {
743-
return
743+
return nil, err
744744
}
745745

746746
if _, err = sess.In("issue_id", deleteCond).
747747
Delete(&TrackedTime{}); err != nil {
748-
return
748+
return nil, err
749749
}
750750

751751
if _, err = sess.In("issue_id", deleteCond).
752752
Delete(&project_model.ProjectIssue{}); err != nil {
753-
return
753+
return nil, err
754754
}
755755

756756
if _, err = sess.In("dependent_issue_id", deleteCond).
757757
Delete(&Comment{}); err != nil {
758-
return
758+
return nil, err
759759
}
760760

761761
var attachments []*repo_model.Attachment
762762
if err = sess.In("issue_id", deleteCond).
763763
Find(&attachments); err != nil {
764-
return
764+
return nil, err
765765
}
766766

767767
for j := range attachments {
@@ -770,11 +770,11 @@ func DeleteIssuesByRepoID(ctx context.Context, repoID int64) (attachmentPaths []
770770

771771
if _, err = sess.In("issue_id", deleteCond).
772772
Delete(&repo_model.Attachment{}); err != nil {
773-
return
773+
return nil, err
774774
}
775775

776776
if _, err = db.DeleteByBean(ctx, &Issue{RepoID: repoID}); err != nil {
777-
return
777+
return nil, err
778778
}
779779

780780
return attachmentPaths, err

0 commit comments

Comments
 (0)