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
{{ message }}
Repository navigation
How can i ignore code generation for a particular field only ? #49
I have a field in my struct that is transient. Meaning it gets generated from random values. I don't want to use that field for equality. Is there a way i can force code generation to ignore a certain field in a struct ? ala autogold:"omitfield"
It's not supported, sorry. The way to do this is to convert your struct into a new struct type or Go value like map[string]any that doesn't contain that field. Then you can pass that value into autogold.
You can also add a String formatter to your Go struct, and then pass that string to autogold instead
Activity
emidoots commentedon Sep 1, 2023
It's not supported, sorry. The way to do this is to convert your struct into a new struct type or Go value like
map[string]anythat doesn't contain that field. Then you can pass that value into autogold.You can also add a String formatter to your Go struct, and then pass that string to autogold instead
ymolists commentedon Sep 6, 2023
Thank you !