Skip to content

Commit

Permalink
style(product): fix product 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 d3478ee commit 5efc7eb
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gomall/app/product/biz/dal/mysql/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func Init() {
}
if os.Getenv("GO_ENV") != "online" {
needDemoData := !DB.Migrator().HasTable(&model.Product{})
DB.AutoMigrate(
DB.AutoMigrate( //nolint:errcheck
&model.Product{},
&model.Category{},
)
Expand Down
2 changes: 1 addition & 1 deletion gomall/app/product/biz/dal/redis/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ func Init() {
if err := mtl.Registry.Register(redisprometheus.NewCollector("default", "product", RedisClient)); err != nil {
klog.Error("redis metric collect error ", err)
}
redisotel.InstrumentTracing(RedisClient)
redisotel.InstrumentTracing(RedisClient) //nolint:errcheck
}
1 change: 0 additions & 1 deletion gomall/app/product/biz/service/get_product_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ func TestGetProduct_Run(t *testing.T) {
t.Errorf("unexpected nil response")
}
// todo: edit your unit test

}
1 change: 0 additions & 1 deletion gomall/app/product/biz/service/list_products_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ func TestListProducts_Run(t *testing.T) {
t.Errorf("unexpected nil response")
}
// todo: edit your unit test

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

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

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

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

}
3 changes: 1 addition & 2 deletions gomall/app/product/conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ type Registry struct {
Password string `yaml:"password"`
}

type ConfigServer struct {
}
type ConfigServer struct{}

// GetConf gets configuration instance
func GetConf() *Config {
Expand Down
1 change: 1 addition & 0 deletions gomall/app/product/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package main

import (
"context"

"github.com/cloudwego/biz-demo/gomall/app/product/biz/service"
product "github.com/cloudwego/biz-demo/gomall/app/product/kitex_gen/product"
)
Expand Down
2 changes: 1 addition & 1 deletion gomall/app/product/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/product/infra/mtl/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ func initMetric() {
err = r.Register(registryInfo)

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

if err != nil {
panic(err)
}

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
}
3 changes: 2 additions & 1 deletion gomall/app/product/infra/mtl/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package mtl

import (
"context"

"github.com/cloudwego/kitex/server"

"github.com/cloudwego/biz-demo/gomall/app/product/conf"
Expand All @@ -31,7 +32,7 @@ var TracerProvider *tracesdk.TracerProvider
func initTracing() {
exporter, err := otlptracegrpc.New(context.Background())
server.RegisterShutdownHook(func() {
exporter.Shutdown(context.Background())
exporter.Shutdown(context.Background()) //nolint:errcheck
})
if err != nil {
panic(err)
Expand Down
1 change: 1 addition & 0 deletions gomall/app/product/rpc/product/product_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package product

import (
"context"

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

0 comments on commit 5efc7eb

Please sign in to comment.