Skip to content

Commit

Permalink
Merge pull request #163 from sunmi-OS/feature/updatenacos
Browse files Browse the repository at this point in the history
upgrade nacos sdk version
  • Loading branch information
luduoxin authored Apr 26, 2024
2 parents 25f252c + 9e80f36 commit 1b78937
Show file tree
Hide file tree
Showing 7 changed files with 300 additions and 73 deletions.
8 changes: 5 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"time"

"github.com/BurntSushi/toml"
"github.com/nacos-group/nacos-sdk-go/clients"
"github.com/nacos-group/nacos-sdk-go/common/constant"
"github.com/nacos-group/nacos-sdk-go/vo"
"github.com/nacos-group/nacos-sdk-go/v2/clients"
"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
"github.com/nacos-group/nacos-sdk-go/v2/vo"
"github.com/sunmi-OS/gocore/retry"
)

Expand All @@ -26,6 +26,7 @@ const (
)

// 解析 acm 或本地 toml 配置到结构体
//
// confPtr: 结构体指针
func ParseToml(group, dataId, localConfig string, confPtr interface{}) (err error) {
beanValue := reflect.ValueOf(confPtr)
Expand Down Expand Up @@ -83,6 +84,7 @@ func ParseToml(group, dataId, localConfig string, confPtr interface{}) (err erro
}

// 解析 acm 或本地 yaml 配置到结构体
//
// confPtr: 结构体指针
func ParseYaml(group, dataId, localConfig string, confPtr interface{}) (err error) {
beanValue := reflect.ValueOf(confPtr)
Expand Down
2 changes: 1 addition & 1 deletion example/nacos/config/nacos.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package config
import (
"os"

"github.com/nacos-group/nacos-sdk-go/common/constant"
"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
"github.com/sunmi-OS/gocore/nacos"
)

Expand Down
14 changes: 9 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ require (
github.com/gin-gonic/gin v1.6.3
github.com/go-redis/redis/v8 v8.6.0
github.com/go-resty/resty/v2 v2.3.0
github.com/golang/protobuf v1.4.3
github.com/golang/protobuf v1.5.2
github.com/google/uuid v1.1.2
github.com/hashicorp/go-multierror v1.1.0
github.com/jinzhu/gorm v1.9.16
github.com/jolestar/go-commons-pool v2.0.0+incompatible
github.com/labstack/echo/v4 v4.2.0
github.com/labstack/gommon v0.3.0
github.com/nacos-group/nacos-sdk-go v1.0.6
github.com/nacos-group/nacos-sdk-go/v2 v2.2.2
github.com/opentracing/opentracing-go v1.1.0
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5
github.com/openzipkin/zipkin-go v0.2.2
github.com/rakyll/statik v0.1.7
github.com/robfig/cron/v3 v3.0.1
github.com/segmentio/kafka-go v0.4.10
Expand All @@ -29,12 +32,13 @@ require (
github.com/streadway/amqp v1.0.0
github.com/tidwall/gjson v1.6.8
github.com/urfave/cli v1.22.5
go.uber.org/zap v1.16.0
go.uber.org/zap v1.21.0
gobot.io/x/gobot v1.14.0
google.golang.org/grpc v1.32.0
google.golang.org/protobuf v1.25.0
google.golang.org/grpc v1.48.0
google.golang.org/protobuf v1.27.1
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/redis.v5 v5.2.9
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)
334 changes: 278 additions & 56 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions nacos/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"errors"
"io/ioutil"

"github.com/nacos-group/nacos-sdk-go/clients/config_client"
"github.com/nacos-group/nacos-sdk-go/vo"
"github.com/nacos-group/nacos-sdk-go/v2/clients/config_client"
"github.com/nacos-group/nacos-sdk-go/v2/vo"
)

type LocalNacos struct {
Expand Down
8 changes: 4 additions & 4 deletions nacos/nacos.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package nacos

import (
"github.com/nacos-group/nacos-sdk-go/clients"
"github.com/nacos-group/nacos-sdk-go/clients/config_client"
"github.com/nacos-group/nacos-sdk-go/common/constant"
"github.com/nacos-group/nacos-sdk-go/vo"
"github.com/nacos-group/nacos-sdk-go/v2/clients"
"github.com/nacos-group/nacos-sdk-go/v2/clients/config_client"
"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
"github.com/nacos-group/nacos-sdk-go/v2/vo"
)

type nacos struct {
Expand Down
3 changes: 1 addition & 2 deletions nacos/viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sync"
"time"

"github.com/nacos-group/nacos-sdk-go/vo"
"github.com/nacos-group/nacos-sdk-go/v2/vo"
"github.com/spf13/cast"
"github.com/sunmi-OS/gocore/viper"
)
Expand Down Expand Up @@ -117,7 +117,6 @@ func (vt *ViperToml) NacosToViper() {
viper.MerageConfigToToml(s)
}

//
func (vt *ViperToml) SetviperBase(configs string) {

viper.MerageConfigToToml(configs)
Expand Down

0 comments on commit 1b78937

Please sign in to comment.