You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on discussion in 1496 a experimental change to allow reducing the build sizes.
This adds a build tag novalidatefn that makes any usage of validateFn panic. The idea is that we can eliminate calls to tryCallValidateFn that in turn uses field.MethodByName that can't be dead code eliminated.
This is more of POC for now, with showing how this could be done. If we are okay with this change I will update the docs and any other thing that is required for this to actually ship.
Reviewed the code in this PR — it addresses the issue correctly. The MethodByName call moves into no_validate_fn.go (default build), and -tags validator_novalidatefn compiles only the panic stub. The registration in baked_in.go stays in both paths, but the stub prevents MethodByName from appearing in the linker's reachability graph.
The build tag naming validator_novalidatefn is good — prefixed with the package name, consistent with how gin does nomsgpack. Would be great to see this land!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on discussion in 1496 a experimental change to allow reducing the build sizes.
This adds a build tag
novalidatefnthat makes any usage ofvalidateFnpanic. The idea is that we can eliminate calls totryCallValidateFnthat in turn usesfield.MethodByNamethat can't be dead code eliminated.This is more of POC for now, with showing how this could be done. If we are okay with this change I will update the docs and any other thing that is required for this to actually ship.