Merge pull request #113 from bilibili/remove-ecode-pb

hidden deprecated package
pull/118/head
cheng wei 6 years ago committed by GitHub
commit 50b05a7b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      pkg/net/rpc/warden/internal/examples/server/main.go
  2. 0
      pkg/net/rpc/warden/internal/pb/ecode.go
  3. 0
      pkg/net/rpc/warden/internal/pb/ecode.pb.go
  4. 0
      pkg/net/rpc/warden/internal/pb/ecode.proto
  5. 2
      pkg/net/rpc/warden/internal/status/status.go
  6. 2
      pkg/net/rpc/warden/internal/status/status_test.go

@ -10,13 +10,11 @@ import (
"time" "time"
"github.com/bilibili/kratos/pkg/ecode" "github.com/bilibili/kratos/pkg/ecode"
epb "github.com/bilibili/kratos/pkg/ecode/pb"
"github.com/bilibili/kratos/pkg/log" "github.com/bilibili/kratos/pkg/log"
"github.com/bilibili/kratos/pkg/net/rpc/warden" "github.com/bilibili/kratos/pkg/net/rpc/warden"
pb "github.com/bilibili/kratos/pkg/net/rpc/warden/internal/proto/testproto" pb "github.com/bilibili/kratos/pkg/net/rpc/warden/internal/proto/testproto"
xtime "github.com/bilibili/kratos/pkg/time" xtime "github.com/bilibili/kratos/pkg/time"
"github.com/golang/protobuf/ptypes"
"google.golang.org/grpc" "google.golang.org/grpc"
) )
@ -26,9 +24,7 @@ type helloServer struct {
func (s *helloServer) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) { func (s *helloServer) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
if in.Name == "err_detail_test" { if in.Name == "err_detail_test" {
any, _ := ptypes.MarshalAny(&pb.HelloReply{Success: true, Message: "this is test detail"}) err, _ := ecode.Error(ecode.AccessDenied, "AccessDenied").WithDetails(&pb.HelloReply{Success: true, Message: "this is test detail"})
err := epb.From(ecode.AccessDenied)
err.ErrDetail = any
return nil, err return nil, err
} }
return &pb.HelloReply{Message: fmt.Sprintf("hello %s from %s", in.Name, s.addr)}, nil return &pb.HelloReply{Message: fmt.Sprintf("hello %s from %s", in.Name, s.addr)}, nil

@ -11,7 +11,7 @@ import (
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"github.com/bilibili/kratos/pkg/ecode" "github.com/bilibili/kratos/pkg/ecode"
"github.com/bilibili/kratos/pkg/ecode/pb" "github.com/bilibili/kratos/pkg/net/rpc/warden/internal/pb"
) )
// togRPCCode convert ecode.Codo to gRPC code // togRPCCode convert ecode.Codo to gRPC code

@ -15,7 +15,7 @@ import (
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"github.com/bilibili/kratos/pkg/ecode" "github.com/bilibili/kratos/pkg/ecode"
"github.com/bilibili/kratos/pkg/ecode/pb" "github.com/bilibili/kratos/pkg/net/rpc/warden/internal/pb"
) )
func TestCodeConvert(t *testing.T) { func TestCodeConvert(t *testing.T) {

Loading…
Cancel
Save