grpc-gateway-buf-consul-swa.../server/consul.go

23 lines
340 B
Go
Raw Normal View History

2024-01-30 07:41:21 +00:00
package server
import (
"log"
consul "github.com/helloworlde/grpc-gateway/consul"
)
func init() {
consul.Init(nil)
}
func consulGrpc() error {
// 创建gRPC服务器实例
if err := consul.Register("hello", grpcAddress, grpcport, "hellotag"); err != nil {
log.Fatalf("consul err:%v", err.Error())
return err
}
return nil
}