Skip to content

Commit

Permalink
style(order): fix order 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 98187e1 commit a22e050
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion gomall/app/order/biz/dal/mysql/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func Init() {
panic(err)
}
if os.Getenv("GO_ENV") != "online" {
DB.AutoMigrate(
DB.AutoMigrate( //nolint:errcheck
&model.Order{},
&model.OrderItem{},
)
Expand Down
4 changes: 1 addition & 3 deletions gomall/app/order/biz/dal/redis/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import (
"github.com/redis/go-redis/v9"
)

var (
RedisClient *redis.Client
)
var RedisClient *redis.Client

func Init() {
RedisClient = redis.NewClient(&redis.Options{
Expand Down
1 change: 0 additions & 1 deletion gomall/app/order/biz/service/list_order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ func TestListOrder_Run(t *testing.T) {
t.Errorf("unexpected nil response")
}
// todo: edit your unit test

}
4 changes: 2 additions & 2 deletions gomall/app/order/biz/service/place_order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ package service

import (
"context"
order "github.com/cloudwego/biz-demo/gomall/app/order/kitex_gen/order"
"testing"

order "github.com/cloudwego/biz-demo/gomall/app/order/kitex_gen/order"
)

func TestPlaceOrder_Run(t *testing.T) {
Expand All @@ -34,5 +35,4 @@ func TestPlaceOrder_Run(t *testing.T) {
t.Errorf("unexpected nil response")
}
// todo: edit your unit test

}
3 changes: 1 addition & 2 deletions gomall/app/order/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 @@ -79,7 +78,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/order/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 := kitexzap.NewLogger(opts...)
Expand Down
4 changes: 2 additions & 2 deletions gomall/app/order/infra/mtl/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func initMetric() {
_ = r.Register(registryInfo)

server.RegisterShutdownHook(func() {
r.Deregister(registryInfo)
r.Deregister(registryInfo) //nolint:errcheck
})

http.Handle("/metrics", promhttp.HandlerFor(Registry, promhttp.HandlerOpts{}))
go http.ListenAndServe(conf.GetConf().Kitex.MetricsPort, nil)
go http.ListenAndServe(conf.GetConf().Kitex.MetricsPort, nil) //nolint:errcheck
}
2 changes: 1 addition & 1 deletion gomall/app/order/infra/mtl/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func initTracing() {
panic(err)
}
server.RegisterShutdownHook(func() {
exporter.Shutdown(context.Background())
exporter.Shutdown(context.Background()) //nolint:errcheck
})
processor := tracesdk.NewBatchSpanProcessor(exporter)
res, err := resource.New(context.Background(), resource.WithAttributes(semconv.ServiceNameKey.String(conf.GetConf().Kitex.Service)))
Expand Down
1 change: 1 addition & 0 deletions gomall/app/order/rpc/order/order_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package order

import (
"context"

order "github.com/cloudwego/biz-demo/gomall/app/order/kitex_gen/order"
"github.com/cloudwego/kitex/client/callopt"
"github.com/cloudwego/kitex/pkg/klog"
Expand Down

0 comments on commit a22e050

Please sign in to comment.