diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index bdcc3040..88618eae 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -33,15 +33,11 @@ jobs: strategy: matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }} steps: - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: 1.21 - uses: actions/checkout@v3 - name: Lint uses: golangci/golangci-lint-action@v3 with: version: latest working-directory: ${{ matrix.workdir }} - args: --timeout 30m -E gofumpt + args: --timeout 30m -E gofumpt --go 1.21 skip-pkg-cache: true diff --git a/book-shop/app/item/main.go b/book-shop/app/item/main.go index 452df044..b10d707e 100644 --- a/book-shop/app/item/main.go +++ b/book-shop/app/item/main.go @@ -49,7 +49,6 @@ func main() { ) err = svr.Run() - if err != nil { log.Println(err.Error()) } diff --git a/gomall/app/cart/biz/service/add_item.go b/gomall/app/cart/biz/service/add_item.go index a00fbeac..64195b91 100644 --- a/gomall/app/cart/biz/service/add_item.go +++ b/gomall/app/cart/biz/service/add_item.go @@ -50,7 +50,6 @@ func (s *AddItemService) Run(req *cart.AddItemReq) (resp *cart.AddItemResp, err ProductId: req.Item.ProductId, Qty: uint32(req.Item.Quantity), }) - if err != nil { return nil, kerrors.NewBizStatusError(50000, err.Error()) } diff --git a/gomall/app/frontend/biz/service/register.go b/gomall/app/frontend/biz/service/register.go index 17c088ed..f37b71a1 100644 --- a/gomall/app/frontend/biz/service/register.go +++ b/gomall/app/frontend/biz/service/register.go @@ -47,7 +47,6 @@ func (h *RegisterService) Run(req *auth.RegisterReq) (resp *common.Empty, err er session := sessions.Default(h.RequestContext) session.Set("user_id", res.UserId) err = session.Save() - if err != nil { return nil, err } diff --git a/gomall/app/frontend/infra/mtl/metric.go b/gomall/app/frontend/infra/mtl/metric.go index 57769285..f9618f87 100644 --- a/gomall/app/frontend/infra/mtl/metric.go +++ b/gomall/app/frontend/infra/mtl/metric.go @@ -53,7 +53,6 @@ func initMetric() route.CtxCallback { } registryInfo := ®istry.Info{Addr: ip, ServiceName: "prometheus", Weight: 1} err = r.Register(registryInfo) - if err != nil { hlog.Error(err) } diff --git a/gomall/app/payment/biz/service/charge.go b/gomall/app/payment/biz/service/charge.go index 9bd86785..55249ce5 100644 --- a/gomall/app/payment/biz/service/charge.go +++ b/gomall/app/payment/biz/service/charge.go @@ -44,7 +44,6 @@ func (s *ChargeService) Run(req *payment.ChargeReq) (resp *payment.ChargeResp, e } err = card.Validate(true) - if err != nil { return nil, kerrors.NewBizStatusError(400, err.Error()) } diff --git a/gomall/app/product/biz/model/product.go b/gomall/app/product/biz/model/product.go index c1a23362..f8d1c352 100644 --- a/gomall/app/product/biz/model/product.go +++ b/gomall/app/product/biz/model/product.go @@ -76,7 +76,6 @@ func (c CachedProductQuery) GetById(productId int) (product Product, err error) } return nil }() - if err != nil { product, err = c.productQuery.GetById(productId) if err != nil { diff --git a/open-payment-platform/pkg/auth/auth.go b/open-payment-platform/pkg/auth/auth.go index 90392f3f..dadbc6a6 100644 --- a/open-payment-platform/pkg/auth/auth.go +++ b/open-payment-platform/pkg/auth/auth.go @@ -16,9 +16,9 @@ package auth import ( + "crypto/rand" "encoding/hex" "errors" - "math/rand" ) type SignType string @@ -54,6 +54,6 @@ func (a *authSM3) Verify(sign string, data map[string]interface{}) bool { func (a *authSM3) Sign(data map[string]interface{}) string { result := make([]byte, 10) - rand.Read(result) + rand.Read(result) //nolint:errcheck return hex.EncodeToString(result) }