mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 17:20:24 +08:00
28 lines
392 B
Go
28 lines
392 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"time"
|
|
|
|
"zero/core/discov"
|
|
)
|
|
|
|
var value = flag.String("v", "value", "the value")
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
client := discov.NewPublisher([]string{"etcd.discovery:2379"}, "028F2C35852D", *value)
|
|
if err := client.KeepAlive(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
defer client.Stop()
|
|
|
|
for {
|
|
time.Sleep(time.Second)
|
|
fmt.Println(*value)
|
|
}
|
|
}
|