diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index c745ce3..87e228c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,9 +13,13 @@ name: "CodeQL" on: push: - branches: [ "main" ] + branches: + - "main" + - "not_main" pull_request: - branches: [ "main" ] + branches: + - "main" + - "not_main" schedule: - cron: '42 14 * * 1' diff --git a/.github/workflows/golangci.yaml b/.github/workflows/golangci.yaml new file mode 100644 index 0000000..a8fae1e --- /dev/null +++ b/.github/workflows/golangci.yaml @@ -0,0 +1,12 @@ +name: security check +on: + push: + branches: + - not_main +jobs: + golangci: + name: golangci + runs-on: ubuntu-22.04 + steps: + - name: check code by golangci + run: golangci-lint run diff --git a/pkg/errno/errno.go b/pkg/errno/errno.go index 987abbe..c91c12d 100644 --- a/pkg/errno/errno.go +++ b/pkg/errno/errno.go @@ -2,7 +2,6 @@ package errno import ( "errors" - "fmt" ) const ( @@ -76,7 +75,7 @@ type ErrNo struct { } func (e ErrNo) Error() string { - return fmt.Sprintf("%s", e.ErrorMsg) + return e.ErrorMsg } func NewErrNo(code int64, msg string) ErrNo { diff --git a/rpc/interaction/dal/cache/init.go b/rpc/interaction/dal/cache/init.go index 9bd136c..734c0d3 100644 --- a/rpc/interaction/dal/cache/init.go +++ b/rpc/interaction/dal/cache/init.go @@ -9,8 +9,8 @@ import ( var ( rLike *redis.Client rComment *redis.Client - rFollow *redis.Client - rMessage *redis.Client + //rFollow *redis.Client + //rMessage *redis.Client ) func Init() { diff --git a/rpc/interaction/handler.go b/rpc/interaction/handler.go index 262b122..b2c0408 100644 --- a/rpc/interaction/handler.go +++ b/rpc/interaction/handler.go @@ -2,7 +2,6 @@ package main import ( interaction "bibi/kitex_gen/interaction" - "bibi/pkg/constants" "bibi/pkg/errno" "bibi/pkg/pack" "bibi/rpc/interaction/service" @@ -44,16 +43,16 @@ func (s *InteractionHandlerImpl) LikeList(ctx context.Context, req *interaction. count := int64(len(allLikeResp)) resp.VideoCount = &count - var likeResp []int64 - if len(allLikeResp) <= int(req.PageNum-1)*constants.PageSize || int(req.PageNum-1)*constants.PageSize < 0 { - resp.Base = pack.BuildBaseResp(nil) - return resp, nil - } else { - fst := int(req.PageNum-1) * constants.PageSize - for i := fst; i < fst+constants.PageSize && i < len(allLikeResp); i++ { - likeResp = append(likeResp, allLikeResp[i]) - } - } + //var likeResp []int64 + //if len(allLikeResp) <= int(req.PageNum-1)*constants.PageSize || int(req.PageNum-1)*constants.PageSize < 0 { + // resp.Base = pack.BuildBaseResp(nil) + // return resp, nil + //} else { + // fst := int(req.PageNum-1) * constants.PageSize + // for i := fst; i < fst+constants.PageSize && i < len(allLikeResp); i++ { + // likeResp = append(likeResp, allLikeResp[i]) + // } + //} //todo: //videosResp:=make([]*video.Video,constants.PageSize) //GetLikeVideoList