Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Each function passes value or pointer to By rules #1

Merged
merged 2 commits into from
Feb 23, 2023
Merged

Conversation

samlown
Copy link
Contributor

@samlown samlown commented Feb 23, 2023

This is a copy of go-ozzo/ozzo-validation#160

As per the original PR:

The combination of Elem().Interface() does not return a pointer, even if the original variable was a pointer. Passing by value to validation rules becomes a problem when the value is a struct with a private mutex. This is the case with structs generated with protoc-gen-go. go vet -copylocks illustrates the problem.

I acknowledge this may be a breaking change for some. If they have written custom rules, the rules receive an empty interface and have to cast the argument to the appropriate type. This argument will be a pointer in cases where it previously wasn't.

@samlown samlown merged commit b0498eb into main Feb 23, 2023
rhafer added a commit to rhafer/ocis that referenced this pull request May 30, 2024
invpop/validation is a fork of go-ozzo/ozzo-validation with some additional
bug fixes. Specifically we need: invopop/validation#1
rhafer added a commit to rhafer/ocis that referenced this pull request May 30, 2024
invpop/validation is a fork of go-ozzo/ozzo-validation with some additional
bug fixes. Specifically we need: invopop/validation#1
rhafer added a commit to rhafer/ocis that referenced this pull request Jun 3, 2024
invpop/validation is a fork of go-ozzo/ozzo-validation with some additional
bug fixes. Specifically we need: invopop/validation#1
rhafer added a commit to rhafer/ocis that referenced this pull request Jun 4, 2024
invpop/validation is a fork of go-ozzo/ozzo-validation with some additional
bug fixes. Specifically we need: invopop/validation#1
rhafer added a commit to owncloud/ocis that referenced this pull request Jun 4, 2024
invpop/validation is a fork of go-ozzo/ozzo-validation with some additional
bug fixes. Specifically we need: invopop/validation#1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant