channelz: Make staticchecker happy on darwin. (#3469)
convertToPtypesDuration is used only in linux. So, moving to the linux specific file so that the staticchecker does not complain on dawrin..
This commit is contained in:

committed by
GitHub

parent
09c4b45e16
commit
166461e2c4
@ -21,11 +21,18 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
durpb "github.com/golang/protobuf/ptypes/duration"
|
||||
channelzpb "google.golang.org/grpc/channelz/grpc_channelz_v1"
|
||||
"google.golang.org/grpc/internal/channelz"
|
||||
)
|
||||
|
||||
func convertToPtypesDuration(sec int64, usec int64) *durpb.Duration {
|
||||
return ptypes.DurationProto(time.Duration(sec*1e9 + usec*1e3))
|
||||
}
|
||||
|
||||
func sockoptToProto(skopts *channelz.SocketOptionData) []*channelzpb.SocketOption {
|
||||
var opts []*channelzpb.SocketOption
|
||||
if skopts.Linger != nil {
|
||||
|
@ -24,10 +24,8 @@ package service
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
durpb "github.com/golang/protobuf/ptypes/duration"
|
||||
wrpb "github.com/golang/protobuf/ptypes/wrappers"
|
||||
"google.golang.org/grpc"
|
||||
channelzgrpc "google.golang.org/grpc/channelz/grpc_channelz_v1"
|
||||
@ -43,10 +41,6 @@ func init() {
|
||||
channelz.TurnOn()
|
||||
}
|
||||
|
||||
func convertToPtypesDuration(sec int64, usec int64) *durpb.Duration {
|
||||
return ptypes.DurationProto(time.Duration(sec*1e9 + usec*1e3))
|
||||
}
|
||||
|
||||
// RegisterChannelzServiceToServer registers the channelz service to the given server.
|
||||
func RegisterChannelzServiceToServer(s *grpc.Server) {
|
||||
channelzgrpc.RegisterChannelzServer(s, newCZServer())
|
||||
|
Reference in New Issue
Block a user