Skip to content
Closed
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
3 changes: 2 additions & 1 deletion templates/goshared/enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const enumTpl = `
{{ template "in" . }}

{{ if $r.GetDefinedOnly }}
if _, ok := {{ (typ $f).Element.Value }}_name[int32({{ accessor . }})]; !ok {
{{ $enumType := inType $f nil }}
if _, ok := {{ $enumType }}_name[int32({{ accessor . }})]; !ok {
err := {{ err . "value must be one of the defined enum values" }}
if !all { return err }
errors = append(errors, err)
Expand Down
2 changes: 1 addition & 1 deletion templates/goshared/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type {{ multierrname . }} []error

// Error returns a concatenation of all the error messages it wraps.
func (m {{ multierrname . }}) Error() string {
msgs := make([]string, 0, len(m))
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion templates/goshared/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (fns goSharedFuncs) externalEnums(file pgs.File) []pgs.Enum {
en = fld.Type().Element().Enum()
}

if en != nil && en.File().Package().ProtoName() != msg.File().Package().ProtoName() {
if en != nil && en.Package().ProtoName() != fld.Package().ProtoName() {
out = append(out, en)
}
}
Expand Down