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
With the introduction of generics, we now have various implementations of optionals, such as this. It would be beneficial to add the ability to specify these field types as optional using configuration.
Suggestion:
Introduce a new configuration option -optypes that accepts a list of regular expressions, similar to the current approach with exclude and include structs.
import "github.com/samber/mo"
type Shape struct {
Length int
Width int
volume mo.Option[int]
}
Running with go run cmd/exhaustruct/main.go -optypes="github.com/samber/mo.Option\[.*\]" . won't return errors.
I've also created a prototype.
Doubts:
What if we want to overwrite optypes for specific case?
The text was updated successfully, but these errors were encountered:
I am really not sure if 'all fields of type x are optinal' should be implemented in the first place.
it is not big of a deal to put tags (soon comment directives will be implemented) to the definition (fairly easily can be achieved with autoreplacement, in case it is largely used across the codebase)
Such filters will add a lot of complication to the linter and bunch of dilemmas, as, for example:
If I make type x optional - should it include x's aliases and reexports?
With the introduction of generics, we now have various implementations of optionals, such as this. It would be beneficial to add the ability to specify these field types as optional using configuration.
Suggestion:
Introduce a new configuration option
-optypes
that accepts a list of regular expressions, similar to the current approach with exclude and include structs.Running with
go run cmd/exhaustruct/main.go -optypes="github.com/samber/mo.Option\[.*\]" .
won't return errors.I've also created a prototype.
Doubts:
What if we want to overwrite
optypes
for specific case?The text was updated successfully, but these errors were encountered: