Skip to content

Commit

Permalink
go: more regression fixes for optional values (#575)
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Klein <[email protected]>
  • Loading branch information
mattklein123 authored Mar 1, 2022
1 parent 7518d9e commit 0f87cc3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion templates/goshared/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ func (fns goSharedFuncs) inType(f pgs.Field, x interface{}) string {
if f.Type().IsRepeated() {
return strings.TrimLeft(fns.Type(f).String(), "[]")
} else {
return fns.Type(f).String()
// Use Value() to strip any potential pointer type.
return fns.Type(f).Value().String()
}
default:
// Use Value() to strip any potential pointer type.
Expand Down
4 changes: 4 additions & 0 deletions tests/harness/cases/enums.proto
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ message EnumInsideOneOf {
oneof foo {
TestEnum val = 1 [(validate.rules).enum.defined_only = true];
}

oneof bar {
TestEnum val2 = 2 [(validate.rules).enum = {defined_only : true not_in : 0}];
}
}

0 comments on commit 0f87cc3

Please sign in to comment.