Skip to content

Commit

Permalink
update example file go.mod
Browse files Browse the repository at this point in the history
  • Loading branch information
whalecold committed Oct 9, 2023
1 parent d63c759 commit cd8cda8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1,596 deletions.
17 changes: 15 additions & 2 deletions example/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,35 @@ import (
"github.com/cloudwego/kitex/pkg/klog"
nacosclient "github.com/kitex-contrib/config-nacos/client"
"github.com/kitex-contrib/config-nacos/nacos"
"github.com/kitex-contrib/config-nacos/utils"
"github.com/nacos-group/nacos-sdk-go/vo"
)

type configLog struct{}

func (cl *configLog) Apply(opt *utils.Options) {
fn := func(cp *vo.ConfigParam) {
klog.Infof("nacos config %v", cp)
}
opt.NacosCustomFunctions = append(opt.NacosCustomFunctions, fn)
}

func main() {
klog.SetLevel(klog.LevelDebug)

nacosClient, err := nacos.New(nacos.Options{})
nacosClient, err := nacos.NewClient(nacos.Options{})
if err != nil {
panic(err)
}

cl := &configLog{}

serviceName := "ServiceName"
clientName := "ClientName"
client, err := echo.NewClient(
serviceName,
client.WithHostPorts("0.0.0.0:8888"),
client.WithSuite(nacosclient.NewSuite(serviceName, clientName, nacosClient)),
client.WithSuite(nacosclient.NewSuite(serviceName, clientName, nacosClient, cl)),
)
if err != nil {
log.Fatal(err)
Expand Down
6 changes: 4 additions & 2 deletions example/client/go.mod → example/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module client
module example

go 1.19

Expand Down Expand Up @@ -41,7 +41,7 @@ require (
github.com/oleiade/lane v1.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.8.2 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/tidwall/gjson v1.9.3 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
Expand All @@ -62,3 +62,5 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/kitex-contrib/config-nacos => ../
5 changes: 2 additions & 3 deletions example/client/go.sum → example/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,6 @@ github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kitex-contrib/config-nacos v0.1.1 h1:v5aaSp9UDDXo3eCzwmJ35hTI6e1Cryjh1AN/JcqVU20=
github.com/kitex-contrib/config-nacos v0.1.1/go.mod h1:a2gHKTXSAS6sxxM02rk92/bsqEGBY09jSAC18h+jxzM=
github.com/kitex-contrib/monitor-prometheus v0.1.0/go.mod h1:ZHWQOKRHnN1Bw+PgVYeOXmB9l4+k8dlOJ9wx2xz76NU=
github.com/kitex-contrib/obs-opentelemetry v0.2.1/go.mod h1:dlxSosfcSPOmUo0UGkJn2oXzFlR5+4caPKXRdnlLOpc=
github.com/kitex-contrib/obs-opentelemetry/logging/logrus v0.0.0-20230219092456-5e6c84962323/go.mod h1:Eml/0Z+CqgGIPf9JXzLGu+N9NJoy2x5pqypN+hmKArE=
Expand Down Expand Up @@ -809,8 +807,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/thrift-iterator/go v0.0.0-20190402154806-9b5a67519118/go.mod h1:60PRwE/TCI1UqLvn8v2pwAf6+yzTPLP/Ji5xaesWDqk=
github.com/tidwall/gjson v1.9.3 h1:hqzS9wAHMO+KVBBkLxYdkEeeFHuqr95GfClRLKlgK0E=
github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
Expand Down
64 changes: 0 additions & 64 deletions example/server/go.mod

This file was deleted.

Loading

0 comments on commit cd8cda8

Please sign in to comment.