Some golint cleanup (#674)
This commit fixes some golint issues in `core/dnsserver` and `middleware/kubernetes`. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
4dc61e67cd
commit
37050dc217
4 changed files with 8 additions and 8 deletions
|
@ -24,7 +24,7 @@ type servergRPC struct {
|
||||||
listenAddr net.Addr
|
listenAddr net.Addr
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGRPCServer returns a new CoreDNS GRPC server and compiles all middleware in to it.
|
// NewServergRPC returns a new CoreDNS GRPC server and compiles all middleware in to it.
|
||||||
func NewServergRPC(addr string, group []*Config) (*servergRPC, error) {
|
func NewServergRPC(addr string, group []*Config) (*servergRPC, error) {
|
||||||
|
|
||||||
s, err := NewServer(addr, group)
|
s, err := NewServer(addr, group)
|
||||||
|
@ -144,9 +144,9 @@ func (s *servergRPC) Query(ctx context.Context, in *pb.DnsPacket) (*pb.DnsPacket
|
||||||
return &pb.DnsPacket{Msg: packed}, nil
|
return &pb.DnsPacket{Msg: packed}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *servergRPC) Shutdown() error {
|
func (s *servergRPC) Shutdown() error {
|
||||||
if g.grpcServer != nil {
|
if s.grpcServer != nil {
|
||||||
g.grpcServer.Stop()
|
s.grpcServer.Stop()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ type serverTLS struct {
|
||||||
*Server
|
*Server
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTLSServer returns a new CoreDNS TLS server and compiles all middleware in to it.
|
// NewServerTLS returns a new CoreDNS TLS server and compiles all middleware in to it.
|
||||||
func NewServerTLS(addr string, group []*Config) (*serverTLS, error) {
|
func NewServerTLS(addr string, group []*Config) (*serverTLS, error) {
|
||||||
|
|
||||||
s, err := NewServer(addr, group)
|
s, err := NewServer(addr, group)
|
||||||
|
|
|
@ -252,6 +252,7 @@ func (s *Server) OnStartupComplete() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tracer ... TODO: Add comment
|
||||||
func (s *Server) Tracer() ot.Tracer {
|
func (s *Server) Tracer() ot.Tracer {
|
||||||
if s.trace == nil {
|
if s.trace == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -85,7 +85,7 @@ var errNoItems = errors.New("no items found")
|
||||||
var errNsNotExposed = errors.New("namespace is not exposed")
|
var errNsNotExposed = errors.New("namespace is not exposed")
|
||||||
var errInvalidRequest = errors.New("invalid query name")
|
var errInvalidRequest = errors.New("invalid query name")
|
||||||
var errZoneNotFound = errors.New("zone not found")
|
var errZoneNotFound = errors.New("zone not found")
|
||||||
var errApiBadPodType = errors.New("expected type *api.Pod")
|
var errAPIBadPodType = errors.New("expected type *api.Pod")
|
||||||
var errPodsDisabled = errors.New("pod records disabled")
|
var errPodsDisabled = errors.New("pod records disabled")
|
||||||
|
|
||||||
// Services implements the ServiceBackend interface.
|
// Services implements the ServiceBackend interface.
|
||||||
|
@ -201,7 +201,6 @@ func (k *Kubernetes) getClientConfig() (*rest.Config, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitKubeCache initializes a new Kubernetes cache.
|
// InitKubeCache initializes a new Kubernetes cache.
|
||||||
|
|
||||||
func (k *Kubernetes) InitKubeCache() (err error) {
|
func (k *Kubernetes) InitKubeCache() (err error) {
|
||||||
|
|
||||||
config, err := k.getClientConfig()
|
config, err := k.getClientConfig()
|
||||||
|
@ -420,7 +419,7 @@ func (k *Kubernetes) findPods(namespace, podname string) (pods []pod, err error)
|
||||||
for _, o := range objList {
|
for _, o := range objList {
|
||||||
p, ok := o.(*api.Pod)
|
p, ok := o.(*api.Pod)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errApiBadPodType
|
return nil, errAPIBadPodType
|
||||||
}
|
}
|
||||||
// If namespace has a wildcard, filter results against Corefile namespace list.
|
// If namespace has a wildcard, filter results against Corefile namespace list.
|
||||||
if nsWildcard && (len(k.Namespaces) > 0) && (!dnsstrings.StringInSlice(p.Namespace, k.Namespaces)) {
|
if nsWildcard && (len(k.Namespaces) > 0) && (!dnsstrings.StringInSlice(p.Namespace, k.Namespaces)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue