This commit is contained in:
John Guo 2023-10-24 10:02:04 +08:00 committed by GitHub
parent db59f4232f
commit bcb479aabb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 104 additions and 57 deletions

View File

@ -3,13 +3,13 @@ module github.com/gogf/gf/cmd/gf/v2
go 1.18
require (
github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.5.5
github.com/gogf/gf/contrib/drivers/mssql/v2 v2.5.5
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.5.5
github.com/gogf/gf/contrib/drivers/oracle/v2 v2.5.5
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.5.5
github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.5.6
github.com/gogf/gf/contrib/drivers/mssql/v2 v2.5.6
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.5.6
github.com/gogf/gf/contrib/drivers/oracle/v2 v2.5.6
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.5.6
github.com/gogf/gf/contrib/drivers/sqlite/v2 v2.5.6
github.com/gogf/gf/v2 v2.5.6
github.com/minio/selfupdate v0.6.0
github.com/olekukonko/tablewriter v0.0.5
golang.org/x/mod v0.9.0

View File

@ -4,7 +4,7 @@ go 1.18
require (
github.com/apolloconfig/agollo/v4 v4.3.1
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
)
require (

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/config/consul/v2
go 1.19
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
github.com/hashicorp/consul/api v1.24.0
github.com/hashicorp/go-cleanhttp v0.5.2
)

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/config/kubecm/v2
go 1.19
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
k8s.io/api v0.27.4
k8s.io/apimachinery v0.27.4
k8s.io/client-go v0.27.4

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/config/nacos/v2
go 1.18
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
github.com/nacos-group/nacos-sdk-go v1.1.4
)

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/config/polaris/v2
go 1.18
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
github.com/polarismesh/polaris-go v1.5.4
)

View File

@ -4,7 +4,7 @@ go 1.18
require (
github.com/ClickHouse/clickhouse-go/v2 v2.0.15
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
github.com/google/uuid v1.3.0
github.com/shopspring/decimal v1.3.1
)

View File

@ -6,7 +6,7 @@ replace github.com/gogf/gf/v2 => ../../../
require (
gitee.com/chunanyong/dm v1.8.10
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
)
require (

View File

@ -4,7 +4,7 @@ go 1.18
require (
github.com/denisenkom/go-mssqldb v0.12.3
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
)
require (

View File

@ -4,7 +4,7 @@ go 1.18
require (
github.com/go-sql-driver/mysql v1.7.1
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
)
require (

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/drivers/oracle/v2
go 1.18
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
github.com/sijms/go-ora/v2 v2.7.10
)

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/drivers/pgsql/v2
go 1.18
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
github.com/lib/pq v1.10.9
)

View File

@ -4,7 +4,7 @@ go 1.18
require (
github.com/glebarez/go-sqlite v1.21.2
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
)
require (

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/drivers/sqlitecgo/v2
go 1.18
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
github.com/mattn/go-sqlite3 v1.14.17
)

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/nosql/redis/v2
go 1.18
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
github.com/redis/go-redis/v9 v9.0.5
go.opentelemetry.io/otel v1.14.0
go.opentelemetry.io/otel/trace v1.14.0

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/registry/etcd/v2
go 1.18
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
go.etcd.io/etcd/client/v3 v3.5.7
)

View File

@ -2,7 +2,7 @@ module github.com/gogf/gf/contrib/registry/file/v2
go 1.18
require github.com/gogf/gf/v2 v2.5.5
require github.com/gogf/gf/v2 v2.5.6
require (
github.com/BurntSushi/toml v1.2.0 // indirect

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/registry/nacos/v2
go 1.18
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
github.com/joy999/nacos-sdk-go v0.0.0-20231008093845-7f2f84bc6faa
)

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/registry/polaris/v2
go 1.18
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
github.com/polarismesh/polaris-go v1.5.4
)

View File

@ -4,7 +4,7 @@ go 1.18
require (
github.com/go-zookeeper/zk v1.0.3
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
golang.org/x/sync v0.3.0
)

View File

@ -3,8 +3,8 @@ module github.com/gogf/gf/contrib/rpc/grpcx/v2
go 1.18
require (
github.com/gogf/gf/contrib/registry/file/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/contrib/registry/file/v2 v2.5.6
github.com/gogf/gf/v2 v2.5.6
go.opentelemetry.io/otel v1.14.0
go.opentelemetry.io/otel/trace v1.14.0
google.golang.org/grpc v1.57.0

View File

@ -2,7 +2,7 @@ module github.com/gogf/gf/contrib/sdk/httpclient/v2
go 1.18
require github.com/gogf/gf/v2 v2.5.5
require github.com/gogf/gf/v2 v2.5.6
require (
github.com/BurntSushi/toml v1.2.0 // indirect

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/trace/jaeger/v2
go 1.18
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
go.opentelemetry.io/otel v1.14.0
go.opentelemetry.io/otel/exporters/jaeger v1.14.0
go.opentelemetry.io/otel/sdk v1.14.0

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/trace/otlpgrpc/v2
go 1.20
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0

View File

@ -3,7 +3,7 @@ module github.com/gogf/gf/contrib/trace/otlphttp/v2
go 1.20
require (
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.6
go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0

View File

@ -3,20 +3,21 @@ module github.com/gogf/gf/example
go 1.20
require (
github.com/gogf/gf/contrib/config/apollo/v2 v2.5.5
github.com/gogf/gf/contrib/config/consul/v2 v2.5.5
github.com/gogf/gf/contrib/config/kubecm/v2 v2.5.5
github.com/gogf/gf/contrib/config/nacos/v2 v2.5.5
github.com/gogf/gf/contrib/config/polaris/v2 v2.5.5
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.5.5
github.com/gogf/gf/contrib/nosql/redis/v2 v2.5.5
github.com/gogf/gf/contrib/registry/etcd/v2 v2.5.5
github.com/gogf/gf/contrib/registry/file/v2 v2.5.5
github.com/gogf/gf/contrib/registry/polaris/v2 v2.5.5
github.com/gogf/gf/contrib/rpc/grpcx/v2 v2.5.5
github.com/gogf/gf/contrib/trace/otlpgrpc/v2 v2.5.5
github.com/gogf/gf/contrib/trace/otlphttp/v2 v2.5.5
github.com/gogf/gf/v2 v2.5.5
github.com/gogf/gf/contrib/config/apollo/v2 v2.5.6
github.com/gogf/gf/contrib/config/consul/v2 v2.5.6
github.com/gogf/gf/contrib/config/kubecm/v2 v2.5.6
github.com/gogf/gf/contrib/config/nacos/v2 v2.5.6
github.com/gogf/gf/contrib/config/polaris/v2 v2.5.6
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.5.6
github.com/gogf/gf/contrib/nosql/redis/v2 v2.5.6
github.com/gogf/gf/contrib/registry/etcd/v2 v2.5.6
github.com/gogf/gf/contrib/registry/file/v2 v2.5.6
github.com/gogf/gf/contrib/registry/nacos/v2 v2.5.5
github.com/gogf/gf/contrib/registry/polaris/v2 v2.5.6
github.com/gogf/gf/contrib/rpc/grpcx/v2 v2.5.6
github.com/gogf/gf/contrib/trace/otlpgrpc/v2 v2.5.6
github.com/gogf/gf/contrib/trace/otlphttp/v2 v2.5.6
github.com/gogf/gf/v2 v2.5.6
github.com/hashicorp/consul/api v1.24.0
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/nacos-group/nacos-sdk-go v1.1.4
@ -53,6 +54,7 @@ require (
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
@ -72,6 +74,7 @@ require (
github.com/imdario/mergo v0.3.6 // indirect
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/joy999/nacos-sdk-go v0.0.0-20231008093845-7f2f84bc6faa // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mailru/easyjson v0.7.7 // indirect

View File

@ -296,6 +296,8 @@ github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogf/gf/contrib/registry/nacos/v2 v2.5.5 h1:SX/Hm8lTVmS+Jgr96nhEfIjkPVFb/G1WHBrJnSkaWtY=
github.com/gogf/gf/contrib/registry/nacos/v2 v2.5.5/go.mod h1:sjXCL0HbPyvRGYHEnuihLfXSkXXrMmoDNKj5D8JT8r0=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
@ -468,6 +470,8 @@ github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5i
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/joy999/nacos-sdk-go v0.0.0-20231008093845-7f2f84bc6faa h1:FPzhsWW/aZQKw9tWOTvLc8lpKLGnPVBMaF0B+DIvKlc=
github.com/joy999/nacos-sdk-go v0.0.0-20231008093845-7f2f84bc6faa/go.mod h1:vks3UUh7Hp+e5qbvDySGnvVCD0RYqjyDy/RpVMSf3xc=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
@ -975,8 +979,6 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44=
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

View File

@ -257,13 +257,11 @@ func (s *Server) checkAndCreateFuncInfo(
return funcInfo, err
}
funcInfo.ReqStructFields = fields
funcInfo.Func = createRouterFunc(funcInfo, inputObject, inputObjectPtr)
funcInfo.Func = createRouterFunc(funcInfo)
return
}
func createRouterFunc(
funcInfo handlerFuncInfo, inputObject reflect.Value, inputObjectPtr interface{},
) func(r *Request) {
func createRouterFunc(funcInfo handlerFuncInfo) func(r *Request) {
return func(r *Request) {
var (
ok bool
@ -272,11 +270,20 @@ func createRouterFunc(
reflect.ValueOf(r.Context()),
}
)
r.error = r.Parse(inputObjectPtr)
if funcInfo.Type.NumIn() == 2 {
var inputObject reflect.Value
if funcInfo.Type.In(1).Kind() == reflect.Ptr {
inputObject = reflect.New(funcInfo.Type.In(1).Elem())
r.error = r.Parse(inputObject.Interface())
} else {
inputObject = reflect.New(funcInfo.Type.In(1).Elem()).Elem()
r.error = r.Parse(inputObject.Addr().Interface())
}
if r.error != nil {
return
}
inputValues = append(inputValues, inputObject)
}
// Call handler with dynamic created parameter values.
results := funcInfo.Value.Call(inputValues)
switch len(results) {

View File

@ -439,3 +439,38 @@ func Test_Issue2963(t *testing.T) {
t.Assert(c.GetContent(ctx, "/"+gurl.Encode("中文G146(1)-icon.txt")), `中文G146(1)-icon`)
})
}
type Issue3077Req struct {
g.Meta `path:"/echo" method:"get"`
A string `default:"a"`
B string `default:""`
}
type Issue3077Res struct {
g.Meta `mime:"text/html"`
}
type Issue3077V1 struct{}
func (c *Issue3077V1) Hello(ctx context.Context, req *Issue3077Req) (res *Issue3077Res, err error) {
g.RequestFromCtx(ctx).Response.Write(fmt.Sprintf("%v", req))
return
}
// https://github.com/gogf/gf/issues/3077
func Test_Issue3077(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
s := g.Server(guid.S())
s.Group("/", func(group *ghttp.RouterGroup) {
group.Bind(Issue3077V1{})
})
s.SetDumpRouterMap(false)
s.Start()
defer s.Shutdown()
time.Sleep(100 * time.Millisecond)
c := g.Client()
c.SetPrefix(fmt.Sprintf("http://127.0.0.1:%d", s.GetListenedPort()))
t.Assert(c.GetContent(ctx, "/echo?a=1&b=2"), `&{{} 1 2}`)
t.Assert(c.GetContent(ctx, "/echo?"), `&{{} a }`)
})
}

View File

@ -2,5 +2,5 @@ package gf
const (
// VERSION is the current GoFrame version.
VERSION = "v2.5.5"
VERSION = "v2.5.6"
)