Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/gjson: change data parameter from type any to []byte #3542

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ linters-settings:
govet:
# Report about shadowed variables.
# Default: false
check-shadowing: true
# 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
5 changes: 3 additions & 2 deletions contrib/config/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import (
"context"
"fmt"

"github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/api/watch"

"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gcfg"
"github.com/gogf/gf/v2/os/glog"
"github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/api/watch"
)

// Config is the configuration object for consul client.
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 @@ -881,7 +881,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