From 3c878dee49a02e91697bc4dc2481128564a00f99 Mon Sep 17 00:00:00 2001 From: LinkinStars Date: Mon, 13 Jan 2025 11:19:25 +0800 Subject: [PATCH 1/4] docs(disclaimer): remove disclaimer --- DISCLAIMER | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 DISCLAIMER diff --git a/DISCLAIMER b/DISCLAIMER deleted file mode 100644 index 009fd82bb..000000000 --- a/DISCLAIMER +++ /dev/null @@ -1,10 +0,0 @@ -Apache Answer is an effort undergoing incubation at the Apache -Software Foundation (ASF), sponsored by the Apache Incubator PMC. - -Incubation is required of all newly accepted projects until a further review -indicates that the infrastructure, communications, and decision making process -have stabilized in a manner consistent with other successful ASF projects. - -While incubation status is not necessarily a reflection of the completeness -or stability of the code, it does indicate that the project has yet to be -fully endorsed by the ASF. \ No newline at end of file From 36faad188011b878c8ea2107e92b9e35da17796d Mon Sep 17 00:00:00 2001 From: LinkinStars Date: Mon, 13 Jan 2025 11:44:57 +0800 Subject: [PATCH 2/4] build(release): remove DISCLAIMER file from release assets --- .goreleaser.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b517defba..c09196937 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -65,8 +65,6 @@ archives: dst: NOTICE - src: "docs/release/licenses/*" dst: licenses/ - - src: "DISCLAIMER" - dst: DISCLAIMER wrap_in_directory: true checksum: name_template: 'checksums.txt' From 774f4b39b7e76af6076bd041319dd6709e471d0a Mon Sep 17 00:00:00 2001 From: Young Xu Date: Tue, 14 Jan 2025 00:02:02 +0800 Subject: [PATCH 3/4] chore: remove excess judgment code Signed-off-by: Young Xu --- internal/controller/answer_controller.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/internal/controller/answer_controller.go b/internal/controller/answer_controller.go index 4504f881c..157e1b253 100644 --- a/internal/controller/answer_controller.go +++ b/internal/controller/answer_controller.go @@ -284,10 +284,6 @@ func (ac *AnswerController) Add(ctx *gin.Context) { objectOwner := ac.rankService.CheckOperationObjectOwner(ctx, req.UserID, info.ID) req.CanEdit = canList[0] || objectOwner req.CanDelete = canList[1] || objectOwner - if !can { - handler.HandleResponse(ctx, errors.Forbidden(reason.RankFailToMeetTheCondition), nil) - return - } info.MemberActions = permission.GetAnswerPermission(ctx, req.UserID, info.UserID, 0, req.CanEdit, req.CanDelete, false) handler.HandleResponse(ctx, nil, gin.H{ From 581f73c85765c9e1b66d8942f1af878cf459a721 Mon Sep 17 00:00:00 2001 From: Young Xu Date: Thu, 16 Jan 2025 11:16:57 +0800 Subject: [PATCH 4/4] chore: instance rand.Seed to rand.Source (#1233) The `rand.Seed` method is currently deprecated, use rand Replace with the `NewSource` method. ``` // Deprecated: As of Go 1.20 there is no reason to call Seed with // a random value. Programs that call Seed with a known value to get // a specific sequence of results should use New(NewSource(seed)) to // obtain a local random generator. ``` --------- Signed-off-by: Young Xu Co-authored-by: LinkinStars --- pkg/uid/id.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/uid/id.go b/pkg/uid/id.go index 3614ea5e7..f2c72baed 100644 --- a/pkg/uid/id.go +++ b/pkg/uid/id.go @@ -34,9 +34,9 @@ type SnowFlakeID struct { var snowFlakeIDGenerator *SnowFlakeID func init() { - // todo - rand.Seed(time.Now().UnixNano()) - node, err := snowflake.NewNode(int64(rand.Intn(1000)) + 1) + source := rand.NewSource(time.Now().UnixNano()) + r := rand.New(source) + node, err := snowflake.NewNode(int64(r.Intn(1000)) + 1) if err != nil { panic(err.Error()) }