需要修复一下gateway
This commit is contained in:
parent
15c27afb44
commit
ebcd27bbd5
7
go.mod
7
go.mod
|
@ -5,9 +5,7 @@ go 1.20
|
|||
require (
|
||||
fusen-basic v0.0.0
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1
|
||||
github.com/nacos-group/nacos-sdk-go/v2 v2.2.3
|
||||
golang.org/x/text v0.14.0
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17
|
||||
google.golang.org/grpc v1.59.0
|
||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
|
||||
google.golang.org/protobuf v1.31.0
|
||||
|
@ -26,6 +24,7 @@ require (
|
|||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/nacos-group/nacos-sdk-go/v2 v2.2.3 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/prometheus/client_golang v1.17.0 // indirect
|
||||
|
@ -33,6 +32,7 @@ require (
|
|||
github.com/prometheus/common v0.45.0 // indirect
|
||||
github.com/prometheus/procfs v0.12.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.11.0 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
go.uber.org/atomic v1.11.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.26.0 // indirect
|
||||
|
@ -41,10 +41,11 @@ require (
|
|||
golang.org/x/sys v0.14.0 // indirect
|
||||
golang.org/x/time v0.4.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace fusen-basic v0.0.0 => gitee.com/fusenpack/fusen-basic v0.0.5-0.20231116081152-8b986d7e7d8d
|
||||
replace fusen-basic v0.0.0 => gitee.com/fusenpack/fusen-basic v0.0.5-0.20231117090447-740c4f28fda6
|
||||
|
|
7
go.sum
7
go.sum
|
@ -1,6 +1,6 @@
|
|||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231116081152-8b986d7e7d8d h1:pT0RRNVq3cmRvgifnmI3RX5pp5zGImqRViefBPDu1OQ=
|
||||
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231116081152-8b986d7e7d8d/go.mod h1:Zw6gt/0VwNmtG2Boqmo8+5H5AVuWsIVgCgp1ilkRyao=
|
||||
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231117090447-740c4f28fda6 h1:u/iTiW6mFHp5/sqEPrO/JalEAur6UK5PKE7YXHJ+/0o=
|
||||
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231117090447-740c4f28fda6/go.mod h1:M6MEfmoOqiH6z2xfGb3WMd+jADI42flrUrNv2WoFE8A=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo=
|
||||
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
||||
|
@ -72,6 +72,8 @@ github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k
|
|||
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
|
@ -118,6 +120,7 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
|
||||
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
|
|
2
proto
2
proto
|
@ -1 +1 @@
|
|||
Subproject commit baaf7f2843d5c5e3485731041afc708392dc048e
|
||||
Subproject commit 52c178825e99f266f148f361db587d06f88806fb
|
|
@ -1,5 +1,7 @@
|
|||
#! /bin/bash
|
||||
|
||||
rm ./gen/go -rf
|
||||
|
||||
./update_fspkg_master.sh
|
||||
|
||||
# 获取当前脚本的全局路径
|
||||
|
|
|
@ -16,7 +16,7 @@ func AutoRegisterHandler(ctx context.Context, mux *runtime.ServeMux, opts ...grp
|
|||
return err
|
||||
}
|
||||
|
||||
err = service.RegisterFsserviceHandlerClientNacos(ctx, mux, opts...)
|
||||
err = service.RegisterInfoHandlerClientNacos(ctx, mux, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -25,15 +25,7 @@ func (m *EmptyMarshaler) Marshal(v interface{}) ([]byte, error) {
|
|||
var fsDefaultProtoJSON = &runtime.JSONPb{
|
||||
MarshalOptions: protojson.MarshalOptions{
|
||||
EmitUnpopulated: true,
|
||||
},
|
||||
UnmarshalOptions: protojson.UnmarshalOptions{
|
||||
DiscardUnknown: true,
|
||||
},
|
||||
}
|
||||
|
||||
var fsProtoDataJSON = &runtime.JSONPb{
|
||||
MarshalOptions: protojson.MarshalOptions{
|
||||
EmitUnpopulated: true,
|
||||
UseProtoNames: true,
|
||||
},
|
||||
UnmarshalOptions: protojson.UnmarshalOptions{
|
||||
DiscardUnknown: true,
|
||||
|
@ -49,12 +41,16 @@ func WriteFusenResponse(fsHeader string, w http.ResponseWriter, resp proto.Messa
|
|||
var err error
|
||||
|
||||
if customResp, ok := resp.(*service.Response); ok {
|
||||
rdata, err = protojson.Marshal(customResp.GetData())
|
||||
if err != nil {
|
||||
return err
|
||||
if customResp.GetData() != nil {
|
||||
rdata, err = fsDefaultProtoJSON.Marshal(customResp.GetData())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
rdata = []byte("null")
|
||||
}
|
||||
} else {
|
||||
rdata, err = protojson.Marshal(resp)
|
||||
rdata, err = fsDefaultProtoJSON.Marshal(resp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user