channelz: Make staticchecker happy on darwin. ()

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:
Easwar Swaminathan
2020-03-19 09:56:47 -07:00
committed by GitHub
parent 09c4b45e16
commit 166461e2c4
2 changed files with 7 additions and 6 deletions
channelz/service

@ -21,11 +21,18 @@
package service package service
import ( import (
"time"
"github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes"
durpb "github.com/golang/protobuf/ptypes/duration"
channelzpb "google.golang.org/grpc/channelz/grpc_channelz_v1" channelzpb "google.golang.org/grpc/channelz/grpc_channelz_v1"
"google.golang.org/grpc/internal/channelz" "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 { func sockoptToProto(skopts *channelz.SocketOptionData) []*channelzpb.SocketOption {
var opts []*channelzpb.SocketOption var opts []*channelzpb.SocketOption
if skopts.Linger != nil { if skopts.Linger != nil {

@ -24,10 +24,8 @@ package service
import ( import (
"context" "context"
"net" "net"
"time"
"github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes"
durpb "github.com/golang/protobuf/ptypes/duration"
wrpb "github.com/golang/protobuf/ptypes/wrappers" wrpb "github.com/golang/protobuf/ptypes/wrappers"
"google.golang.org/grpc" "google.golang.org/grpc"
channelzgrpc "google.golang.org/grpc/channelz/grpc_channelz_v1" channelzgrpc "google.golang.org/grpc/channelz/grpc_channelz_v1"
@ -43,10 +41,6 @@ func init() {
channelz.TurnOn() 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. // RegisterChannelzServiceToServer registers the channelz service to the given server.
func RegisterChannelzServiceToServer(s *grpc.Server) { func RegisterChannelzServiceToServer(s *grpc.Server) {
channelzgrpc.RegisterChannelzServer(s, newCZServer()) channelzgrpc.RegisterChannelzServer(s, newCZServer())