Skip to content

Commit

Permalink
refactor(encoding/gjson): change data parameter from type any to []by…
Browse files Browse the repository at this point in the history
…te (gogf#3542)
  • Loading branch information
gqcn authored Sep 28, 2024
1 parent cf74223 commit 9589384
Show file tree
Hide file tree
Showing 21 changed files with 482 additions and 394 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ linters-settings:

# https://golangci-lint.run/usage/linters/#govet
govet:
# Report about shadowed variables.
# Default: false
# check-shadowing: true
# Settings per analyzer.
settings:
# Analyzer name, run `go tool vet help` to see all analyzers.
Expand Down
1 change: 1 addition & 0 deletions contrib/config/apollo/apollo.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/apolloconfig/agollo/v4"
apolloConfig "github.com/apolloconfig/agollo/v4/env/config"
"github.com/apolloconfig/agollo/v4/storage"

"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
Expand Down
2 changes: 1 addition & 1 deletion contrib/config/kubecm/kubecm.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (c *Client) doUpdate(ctx context.Context, namespace string) (err error) {
)
}
var j *gjson.Json
if j, err = gjson.LoadContent(cm.Data[c.config.DataItem]); err != nil {
if j, err = gjson.LoadContent([]byte(cm.Data[c.config.DataItem])); err != nil {
return gerror.Wrapf(
err,
`parse config map item from %s[%s] failed`, c.config.ConfigMap, c.config.DataItem,
Expand Down
2 changes: 1 addition & 1 deletion contrib/config/nacos/nacos.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (c *Client) updateLocalValue() (err error) {

func (c *Client) doUpdate(content string) (err error) {
var j *gjson.Json
if j, err = gjson.LoadContent(content); err != nil {
if j, err = gjson.LoadContent([]byte(content)); err != nil {
return gerror.Wrap(err, `parse config map item from nacos failed`)
}
c.value.Set(j)
Expand Down
2 changes: 1 addition & 1 deletion contrib/config/polaris/polaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (c *Client) doUpdate(ctx context.Context) (err error) {
return gerror.New("config file is empty")
}
var j *gjson.Json
if j, err = gjson.LoadContent(c.client.GetContent()); err != nil {
if j, err = gjson.LoadContent([]byte(c.client.GetContent())); err != nil {
return gerror.Wrap(err, `parse config map item from polaris failed`)
}
c.value.Set(j)
Expand Down
2 changes: 1 addition & 1 deletion contrib/drivers/mssql/mssql_z_unit_basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ func Test_DB_ToJson(t *testing.T) {
}

// ToJson
resultJson, err := gjson.LoadContent(result.Json())
resultJson, err := gjson.LoadContent([]byte(result.Json()))
if err != nil {
gtest.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/drivers/mysql/mysql_z_unit_core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ func Test_DB_ToJson(t *testing.T) {
}

// ToJson
resultJson, err := gjson.LoadContent(result.Json())
resultJson, err := gjson.LoadContent([]byte(result.Json()))
if err != nil {
gtest.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/drivers/sqlite/sqlite_z_unit_core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ func Test_DB_ToJson(t *testing.T) {
}

// ToJson
resultJson, err := gjson.LoadContent(result.Json())
resultJson, err := gjson.LoadContent([]byte(result.Json()))
if err != nil {
gtest.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/drivers/sqlitecgo/sqlitecgo_z_unit_core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ func Test_DB_ToJson(t *testing.T) {
}

// ToJson
resultJson, err := gjson.LoadContent(result.Json())
resultJson, err := gjson.LoadContent([]byte(result.Json()))
if err != nil {
gtest.Fatal(err)
}
Expand Down
Loading

0 comments on commit 9589384

Please sign in to comment.