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

optimize: remove useless reflection code #217

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions generator/golang/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ type Features struct {
AlwaysGenerateJSONTag bool `always_gen_json_tag:"Always generate 'json' tag even if go.tag is provided (Disabled by default)"`
SnakeTyleJSONTag bool `snake_style_json_tag:"Generate snake style json tag"`
LowerCamelCaseJSONTag bool `lower_camel_style_json_tag:"Generate lower camel case style json tag"`
GenerateReflectionInfo bool `generate_reflection_info:"This option is no longer used. Please use with_reflection instead."`
WithReflection bool `with_reflection:"Generate reflection info"`
EnumAsINT32 bool `enum_as_int_32:"Generate enum type as int32"`
CodeRefSlim bool `code_ref_slim:"Generate code ref by given idl-ref.yaml with less refs to avoid conflict"`
Expand Down Expand Up @@ -98,7 +97,6 @@ var defaultFeatures = Features{
AlwaysGenerateJSONTag: false,
SnakeTyleJSONTag: false,
LowerCamelCaseJSONTag: false,
GenerateReflectionInfo: false,
ThriftStreaming: false,
EnumAsINT32: false,
TrimIDL: false,
Expand Down
5 changes: 0 additions & 5 deletions generator/golang/scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/cloudwego/thriftgo/generator/golang/streaming"
"github.com/cloudwego/thriftgo/parser"
"github.com/cloudwego/thriftgo/pkg/namespace"
"github.com/cloudwego/thriftgo/reflection"
"github.com/cloudwego/thriftgo/thrift_reflection"
)

Expand Down Expand Up @@ -145,10 +144,6 @@ func (s *Scope) FilePackage() string {
return s.importPackage
}

func (s *Scope) IDLMeta() string {
return reflection.Encode(s.ast)
}

func (s *Scope) IDLName() string {
idlName := strings.TrimSuffix(s.ast.Filename, ".thrift")
arr := strings.Split(idlName, string(filepath.Separator))
Expand Down
7 changes: 0 additions & 7 deletions generator/golang/templates/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package {{.FilePackage}}

import (
{{InsertionPoint "imports"}}
{{- if Features.GenerateReflectionInfo}}thriftreflection "github.com/cloudwego/kitex/pkg/reflection/thrift"{{end}}
)

{{template "Constant" .}}
Expand Down Expand Up @@ -68,11 +67,5 @@ var (
{{- end}}
{{- end}}

{{- if Features.GenerateReflectionInfo}}
var file_{{.IDLName}}_rawDesc = {{.IDLMeta}}
func init(){
thriftreflection.RegisterIDL(file_{{.IDLName}}_rawDesc)
}
{{end}}
{{- InsertionPoint "eof"}}
`
1 change: 0 additions & 1 deletion generator/golang/templates/raw_struct/raw_struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ package {{.FilePackage}}

import (
{{InsertionPoint "imports"}}
{{- if Features.GenerateReflectionInfo}}thriftreflection "github.com/cloudwego/kitex/pkg/reflection/thrift"{{end}}
)

{{template "Constant" .}}
Expand Down
109 changes: 0 additions & 109 deletions reflection/FileDescriptor.go

This file was deleted.

Loading