Skip to content

Commit

Permalink
optimize: remove useless reflection code (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
HeyJavaBean authored Jul 11, 2024
1 parent 798e370 commit 43f56c1
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 124 deletions.
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.

0 comments on commit 43f56c1

Please sign in to comment.