mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-14 02:33:03 +02:00
chore(examples): optimize typos of swagger/server (#1862)
This commit is contained in:
parent
ed6ab7caf9
commit
79057d4326
@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
|
||||
pb "github.com/go-kratos/kratos/examples/swagger/helloworld"
|
||||
reply "github.com/go-kratos/kratos/examples/swagger/reply"
|
||||
"github.com/go-kratos/kratos/examples/swagger/reply"
|
||||
"github.com/go-kratos/kratos/v2"
|
||||
"github.com/go-kratos/kratos/v2/errors"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
@ -28,7 +28,7 @@ type server struct {
|
||||
}
|
||||
|
||||
// SayHello implements helloworld.GreeterServer
|
||||
func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
|
||||
func (s *server) SayHello(_ context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
|
||||
if in.Name == "error" {
|
||||
return nil, errors.BadRequest("custom_error", fmt.Sprintf("invalid argument %s", in.Name))
|
||||
}
|
||||
@ -40,9 +40,9 @@ func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloRe
|
||||
}
|
||||
|
||||
func main() {
|
||||
logger := log.NewStdLogger(os.Stdout)
|
||||
stdLogger := log.NewStdLogger(os.Stdout)
|
||||
|
||||
log := log.NewHelper(logger)
|
||||
logger := log.NewHelper(stdLogger)
|
||||
s := &server{}
|
||||
|
||||
httpSrv := http.NewServer(http.Address(":8000"))
|
||||
@ -62,6 +62,6 @@ func main() {
|
||||
)
|
||||
|
||||
if err := app.Run(); err != nil {
|
||||
log.Error(err)
|
||||
logger.Error(err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user