Skip to content

Commit

Permalink
fix: raw_struct will generate bad code when thrift has typedef
Browse files Browse the repository at this point in the history
  • Loading branch information
wzekin committed Aug 21, 2024
1 parent 9938356 commit 5c0aa51
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions generator/golang/templates/raw_struct/raw_struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func Extension() []string {
return []string{
StructLike,
File,
Typedef,
}
}

Expand Down Expand Up @@ -83,5 +84,17 @@ import (
{{- end}}
{{- InsertionPoint "eof"}}
`
Typedef = `
{{define "Typedef"}}
{{- $NewTypeName := .GoName}}
{{- $OldTypeName := .GoTypeName}}
{{- if and Features.ReserveComments .ReservedComments}}{{.ReservedComments}}{{end}}
{{- if Features.TypedefAsTypeAlias }}
type {{$NewTypeName}} = {{$OldTypeName}}
{{- else}}
type {{$NewTypeName}} {{$OldTypeName}}
{{- end}}
{{- end}}{{/* define "Typedef" */}}
`
)

0 comments on commit 5c0aa51

Please sign in to comment.