Skip to content

Commit

Permalink
Add comments to correct linter to internal type getters (#3654)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjdawson2016 authored Oct 15, 2020
1 parent d063f27 commit 9815a9c
Show file tree
Hide file tree
Showing 3 changed files with 1,558 additions and 121 deletions.
4 changes: 3 additions & 1 deletion common/types/generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ var structTemplate = template.Must(template.New("struct type").Funcs(funcMap).Pa
type {{internal .Type.Name}} struct {
{{range .Fields}} {{internal .Name}} {{if .Type.IsMap}}map[string]{{end}}{{if .Type.IsArray}}[]{{end}}{{if .Type.IsPointer}}*{{end}}{{internal .Type.Name}}
{{end}}}
{{range .Fields}}func (v *{{internal $.Type.Name}}) Get{{internal .Name}}() (o {{if .Type.IsMap}}map[string]{{end}}{{if .Type.IsArray}}[]{{end}}{{if .Type.IsPointer | and (not .Type.IsPrimitive) | and (not .Type.IsEnum)}}*{{end}}{{internal .Type.Name}}) {
{{range .Fields}}
// Get{{internal .Name}} is an internal getter (TBD...)
func (v *{{internal $.Type.Name}}) Get{{internal .Name}}() (o {{if .Type.IsMap}}map[string]{{end}}{{if .Type.IsArray}}[]{{end}}{{if .Type.IsPointer | and (not .Type.IsPrimitive) | and (not .Type.IsEnum)}}*{{end}}{{internal .Type.Name}}) {
if v != nil{{if .Type.IsMap | or .Type.IsArray | or .Type.IsPointer}} && v.{{internal .Name}} != nil{{end}} {
return {{if .Type.IsPointer | and (or .Type.IsPrimitive .Type.IsEnum)}}*{{end}}v.{{internal .Name}}
}
Expand Down
Loading

0 comments on commit 9815a9c

Please sign in to comment.