From 166461e2c4f7435f8fe20bb66215bdfa153e3361 Mon Sep 17 00:00:00 2001 From: Easwar Swaminathan Date: Thu, 19 Mar 2020 09:56:47 -0700 Subject: [PATCH] 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.. --- channelz/service/func_linux.go | 7 +++++++ channelz/service/service.go | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/channelz/service/func_linux.go b/channelz/service/func_linux.go index 192c3a1f..cfa457a6 100644 --- a/channelz/service/func_linux.go +++ b/channelz/service/func_linux.go @@ -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 { diff --git a/channelz/service/service.go b/channelz/service/service.go index 0fad08f9..c8174e5e 100644 --- a/channelz/service/service.go +++ b/channelz/service/service.go @@ -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())