Skip to content

Commit

Permalink
style(frontend): fix frontend lint
Browse files Browse the repository at this point in the history
Signed-off-by: rogerogers <[email protected]>
  • Loading branch information
rogerogers committed Jan 4, 2024
1 parent 13b97d4 commit 98187e1
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions gomall/app/frontend/biz/service/about.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package service

import (
"context"

"github.com/cloudwego/hertz/pkg/common/utils"

common "github.com/cloudwego/biz-demo/gomall/app/frontend/hertz_gen/frontend/common"
Expand Down
4 changes: 3 additions & 1 deletion gomall/app/frontend/biz/service/add_cart_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package service

import (
"context"

"github.com/cloudwego/biz-demo/gomall/app/frontend/hertz_gen/frontend/cart"
common "github.com/cloudwego/biz-demo/gomall/app/frontend/hertz_gen/frontend/common"
"github.com/cloudwego/biz-demo/gomall/app/frontend/infra/rpc"
Expand All @@ -39,6 +40,7 @@ func (h *AddCartItemService) Run(req *cart.AddCartReq) (resp *common.Empty, err
Item: &rpccart.CartItem{
ProductId: req.ProductId,
Quantity: req.ProductNum,
}})
},
})
return
}
1 change: 1 addition & 0 deletions gomall/app/frontend/biz/service/checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (h *CheckoutService) Run(req *checkout.CheckoutReq) (resp map[string]any, e

carts, err := rpc.CartClient.GetCart(h.Context, &rpccart.GetCartRequest{UserId: userId})
if err != nil {
return nil, err
}
var total float32
for _, v := range carts.Items {
Expand Down
1 change: 1 addition & 0 deletions gomall/app/frontend/biz/service/checkout_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package service

import (
"context"

"github.com/cloudwego/hertz/pkg/common/utils"

common "github.com/cloudwego/biz-demo/gomall/app/frontend/hertz_gen/frontend/common"
Expand Down
1 change: 1 addition & 0 deletions gomall/app/frontend/biz/service/checkout_waiting.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package service

import (
"context"

"github.com/cloudwego/biz-demo/gomall/app/frontend/hertz_gen/frontend/checkout"
"github.com/cloudwego/biz-demo/gomall/app/frontend/infra/rpc"
rpccheckout "github.com/cloudwego/biz-demo/gomall/app/frontend/kitex_gen/checkout"
Expand Down
1 change: 1 addition & 0 deletions gomall/app/frontend/biz/service/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package service

import (
"context"

auth "github.com/cloudwego/biz-demo/gomall/app/frontend/hertz_gen/frontend/auth"
"github.com/cloudwego/biz-demo/gomall/app/frontend/infra/rpc"
rpcuser "github.com/cloudwego/biz-demo/gomall/app/frontend/kitex_gen/user"
Expand Down
2 changes: 1 addition & 1 deletion gomall/app/frontend/biz/service/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ func NewLogoutService(Context context.Context, RequestContext *app.RequestContex
func (h *LogoutService) Run(req *common.Empty) (resp *common.Empty, err error) {
session := sessions.Default(h.RequestContext)
session.Clear()
session.Save()
session.Save() //nolint:errcheck
return
}
1 change: 0 additions & 1 deletion gomall/app/frontend/biz/service/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func (h *RegisterService) Run(req *auth.RegisterReq) (resp *common.Empty, err er
Password: req.Password,
ConfirmPassword: req.Password,
})

if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions gomall/app/frontend/conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package conf

import (
"io/ioutil"
"os"
"path/filepath"
"sync"
Expand Down Expand Up @@ -73,7 +72,7 @@ func GetConf() *Config {
func initConf() {
prefix := "conf"
confFileRelPath := filepath.Join(prefix, filepath.Join(GetEnv(), "conf.yaml"))
content, err := ioutil.ReadFile(confFileRelPath)
content, err := os.ReadFile(confFileRelPath)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion gomall/app/frontend/infra/mtl/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func initLog() {
FlushInterval: time.Minute,
}
server.RegisterShutdownHook(func() {
output.Sync()
output.Sync() //nolint:errcheck
})
}
log := hertzzap.NewLogger(opts...)
Expand Down
9 changes: 5 additions & 4 deletions gomall/app/frontend/infra/mtl/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ package mtl
import (
"context"
"fmt"
"github.com/cloudwego/biz-demo/gomall/app/frontend/conf"
"github.com/cloudwego/hertz/pkg/common/utils"
"net"
"net/http"

"github.com/cloudwego/biz-demo/gomall/app/frontend/conf"
"github.com/cloudwego/hertz/pkg/common/utils"

"github.com/cloudwego/hertz/pkg/app/server/registry"
"github.com/cloudwego/hertz/pkg/common/hlog"
"github.com/cloudwego/hertz/pkg/route"
Expand Down Expand Up @@ -58,8 +59,8 @@ func initMetric() route.CtxCallback {
}

http.Handle("/metrics", promhttp.HandlerFor(Registry, promhttp.HandlerOpts{}))
go http.ListenAndServe(fmt.Sprintf(":%d", conf.GetConf().Hertz.MetricsPort), nil)
go http.ListenAndServe(fmt.Sprintf(":%d", conf.GetConf().Hertz.MetricsPort), nil) //nolint:errcheck
return func(ctx context.Context) {
r.Deregister(registryInfo)
r.Deregister(registryInfo) //nolint:errcheck
}
}
2 changes: 1 addition & 1 deletion gomall/app/frontend/infra/mtl/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ func InitTracing() route.CtxCallback {
otel.SetTracerProvider(TracerProvider)

return route.CtxCallback(func(ctx context.Context) {
exporter.Shutdown(ctx)
exporter.Shutdown(ctx) //nolint:errcheck
})
}

0 comments on commit 98187e1

Please sign in to comment.