Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
shenqidebaozi committed Oct 22, 2024
1 parent ec91876 commit b63ff1a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions middleware/logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package logging
import (
"context"
"fmt"
httpstatus "github.com/go-kratos/kratos/v2/transport/http/status"
"google.golang.org/grpc/codes"
"time"

"google.golang.org/grpc/codes"

"github.com/go-kratos/kratos/v2/errors"
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/middleware"
"github.com/go-kratos/kratos/v2/transport"
"github.com/go-kratos/kratos/v2/transport/http/status"
)

// Redacter defines how to log an object
Expand All @@ -30,7 +31,7 @@ func Server(logger log.Logger) middleware.Middleware {
)

// default code
code = int32(httpstatus.FromGRPCCode(codes.OK))
code = int32(status.FromGRPCCode(codes.OK))

startTime := time.Now()
if info, ok := transport.FromServerContext(ctx); ok {
Expand Down Expand Up @@ -70,7 +71,7 @@ func Client(logger log.Logger) middleware.Middleware {
)

// default code
code = int32(httpstatus.FromGRPCCode(codes.OK))
code = int32(status.FromGRPCCode(codes.OK))

startTime := time.Now()
if info, ok := transport.FromClientContext(ctx); ok {
Expand Down
16 changes: 8 additions & 8 deletions middleware/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ package metrics

import (
"context"
httpstatus "github.com/go-kratos/kratos/v2/transport/http/status"
"google.golang.org/grpc/codes"
"time"

"github.com/go-kratos/kratos/v2/errors"
"github.com/go-kratos/kratos/v2/middleware"
"github.com/go-kratos/kratos/v2/transport"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
metricsdk "go.opentelemetry.io/otel/sdk/metric"
"google.golang.org/grpc/codes"

"github.com/go-kratos/kratos/v2/errors"
"github.com/go-kratos/kratos/v2/middleware"
"github.com/go-kratos/kratos/v2/transport"
"github.com/go-kratos/kratos/v2/transport/http/status"
)

const (
Expand Down Expand Up @@ -119,7 +119,7 @@ func Server(opts ...Option) middleware.Middleware {
)

// default code
code = httpstatus.FromGRPCCode(codes.OK)
code = status.FromGRPCCode(codes.OK)

startTime := time.Now()
if info, ok := transport.FromServerContext(ctx); ok {
Expand Down Expand Up @@ -172,7 +172,7 @@ func Client(opts ...Option) middleware.Middleware {
)

// default code
code = httpstatus.FromGRPCCode(codes.OK)
code = status.FromGRPCCode(codes.OK)

startTime := time.Now()
if info, ok := transport.FromClientContext(ctx); ok {
Expand Down

0 comments on commit b63ff1a

Please sign in to comment.