ozzo-validation icon indicating copy to clipboard operation
ozzo-validation copied to clipboard

Each function passes the correct value or pointer to rules.

Open dane opened this issue 4 years ago • 1 comments

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.

dane avatar Dec 02 '21 08:12 dane

@qiangxue is this package still being maintained? I'm seeing several open PRs and there haven't been any commits in over a year.

daneharrigan avatar Dec 02 '21 22:12 daneharrigan