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

perf: enhance default tag for pointer type #48

Closed
wants to merge 2 commits into from

Conversation

hnimtadd
Copy link

No description provided.

@coveralls
Copy link

coveralls commented Dec 15, 2024

Coverage Status

coverage: 95.019% (+0.4%) from 94.66%
when pulling b1cd38c on hnimtadd:enhance-default-tag
into 4214131 on go-playground:master.

@hnimtadd hnimtadd force-pushed the enhance-default-tag branch from fab3464 to f68af3e Compare December 15, 2024 14:38
@hnimtadd hnimtadd force-pushed the enhance-default-tag branch from f68af3e to b1cd38c Compare December 15, 2024 14:52
// 2. Attempting to set its underlying value
// Try to convert the parameter string to the appropriate primitive type
// that the pointer references (e.g., *string, *int, *bool)
value, err := mold.GetPrimitiveValue(fl.Field().Type().Elem().Kind(), fl.Param())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the new GetPrimitiveValue function could we change the function signature of setValue to accept reflect.Value and string(the param) and recursively call it dereferencing the pointer.

This would avoid needing the new function I think and addition of the new error types as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some time to do and test this today #49

everything should be working as expected as of Release 4.5.1 https://github.com/go-playground/mold/releases/tag/v4.5.1

@deankarn
Copy link
Contributor

I very much appreciate the PR it helped visualize the issue and by providing relevant tests :)

Closing as #49 resolved this is a slightly different way and is now part of release https://github.com/go-playground/mold/releases/tag/v4.5.1

@deankarn deankarn closed this Dec 29, 2024
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.

3 participants