server/grpc: Prune Unused Code (#1220)
* server/grpc: remove unused grpcServer.newCodec() * server/grpc: remove unused defaultRPCCodecs
This commit is contained in:
		
							
								
								
									
										10
									
								
								codec.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								codec.go
									
									
									
									
									
								
							| @@ -10,8 +10,6 @@ import ( | ||||
| 	"github.com/golang/protobuf/proto" | ||||
| 	"github.com/micro/go-micro/v2/codec" | ||||
| 	"github.com/micro/go-micro/v2/codec/bytes" | ||||
| 	"github.com/micro/go-micro/v2/codec/jsonrpc" | ||||
| 	"github.com/micro/go-micro/v2/codec/protorpc" | ||||
| 	"google.golang.org/grpc" | ||||
| 	"google.golang.org/grpc/encoding" | ||||
| 	"google.golang.org/grpc/metadata" | ||||
| @@ -35,14 +33,6 @@ var ( | ||||
| 		"application/grpc+proto":   protoCodec{}, | ||||
| 		"application/grpc+bytes":   bytesCodec{}, | ||||
| 	} | ||||
|  | ||||
| 	defaultRPCCodecs = map[string]codec.NewCodec{ | ||||
| 		"application/json":         jsonrpc.NewCodec, | ||||
| 		"application/json-rpc":     jsonrpc.NewCodec, | ||||
| 		"application/protobuf":     protorpc.NewCodec, | ||||
| 		"application/proto-rpc":    protorpc.NewCodec, | ||||
| 		"application/octet-stream": protorpc.NewCodec, | ||||
| 	} | ||||
| ) | ||||
|  | ||||
| func (w wrapCodec) String() string { | ||||
|   | ||||
							
								
								
									
										11
									
								
								grpc.go
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								grpc.go
									
									
									
									
									
								
							| @@ -16,7 +16,6 @@ import ( | ||||
|  | ||||
| 	"github.com/golang/protobuf/proto" | ||||
| 	"github.com/micro/go-micro/v2/broker" | ||||
| 	"github.com/micro/go-micro/v2/codec" | ||||
| 	"github.com/micro/go-micro/v2/errors" | ||||
| 	meta "github.com/micro/go-micro/v2/metadata" | ||||
| 	"github.com/micro/go-micro/v2/registry" | ||||
| @@ -510,16 +509,6 @@ func (g *grpcServer) newGRPCCodec(contentType string) (encoding.Codec, error) { | ||||
| 	return nil, fmt.Errorf("Unsupported Content-Type: %s", contentType) | ||||
| } | ||||
|  | ||||
| func (g *grpcServer) newCodec(contentType string) (codec.NewCodec, error) { | ||||
| 	if cf, ok := g.opts.Codecs[contentType]; ok { | ||||
| 		return cf, nil | ||||
| 	} | ||||
| 	if cf, ok := defaultRPCCodecs[contentType]; ok { | ||||
| 		return cf, nil | ||||
| 	} | ||||
| 	return nil, fmt.Errorf("Unsupported Content-Type: %s", contentType) | ||||
| } | ||||
|  | ||||
| func (g *grpcServer) Options() server.Options { | ||||
| 	g.RLock() | ||||
| 	opts := g.opts | ||||
|   | ||||
		Reference in New Issue
	
	Block a user