mirror of
https://gitee.com/johng/gf
synced 2026-06-25 01:05:41 +08:00
26 lines
456 B
Go
26 lines
456 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/gogf/gf/contrib/registry/etcd/v2"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/net/gsvc"
|
|
"github.com/gogf/gf/v2/os/gctx"
|
|
)
|
|
|
|
func main() {
|
|
gsvc.SetRegistry(etcd.New(`127.0.0.1:2379`))
|
|
|
|
for i := 0; i < 100; i++ {
|
|
res, err := g.Client().Get(gctx.New(), `http://hello.svc/`)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println(res.ReadAllString())
|
|
res.Close()
|
|
time.Sleep(time.Second)
|
|
}
|
|
}
|