mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 09:00:20 +08:00
feat: support build tag to reduce binary size w/o k8s (#4323)
This commit is contained in:
parent
e220d3a4cb
commit
9d9c7e0fe0
@ -1,3 +1,5 @@
|
||||
//go:build !no_k8s
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
|
8
zrpc/resolver/internal/register.go
Normal file
8
zrpc/resolver/internal/register.go
Normal file
@ -0,0 +1,8 @@
|
||||
//go:build no_k8s
|
||||
|
||||
package internal
|
||||
|
||||
// RegisterResolver registers the direct, etcd and discov schemes to the resolver.
|
||||
func RegisterResolver() {
|
||||
register()
|
||||
}
|
13
zrpc/resolver/internal/register_k8s.go
Normal file
13
zrpc/resolver/internal/register_k8s.go
Normal file
@ -0,0 +1,13 @@
|
||||
//go:build !no_k8s
|
||||
|
||||
package internal
|
||||
|
||||
import "google.golang.org/grpc/resolver"
|
||||
|
||||
var k8sResolverBuilder kubeBuilder
|
||||
|
||||
// RegisterResolver registers the direct, etcd, discov and k8s schemes to the resolver.
|
||||
func RegisterResolver() {
|
||||
register()
|
||||
resolver.Register(&k8sResolverBuilder)
|
||||
}
|
@ -28,15 +28,12 @@ var (
|
||||
directResolverBuilder directBuilder
|
||||
discovResolverBuilder discovBuilder
|
||||
etcdResolverBuilder etcdBuilder
|
||||
k8sResolverBuilder kubeBuilder
|
||||
)
|
||||
|
||||
// RegisterResolver registers the direct and discov schemes to the resolver.
|
||||
func RegisterResolver() {
|
||||
func register() {
|
||||
resolver.Register(&directResolverBuilder)
|
||||
resolver.Register(&discovResolverBuilder)
|
||||
resolver.Register(&etcdResolverBuilder)
|
||||
resolver.Register(&k8sResolverBuilder)
|
||||
}
|
||||
|
||||
type nopResolver struct {
|
||||
|
Loading…
Reference in New Issue
Block a user