options-gen
options-gen copied to clipboard
Provide a way to mark options as deprecated
In a real world we change our software sometimes, but is some cases - we would like to have an option to provide a smooth way to migrate from old options to a new one.
example:
// Old options that contains a logger
type Options struct {
logger *zap.Logger `option:"mandatory"`
}
// For example we would like to migrate from zap to slog. So we want to migrate to a new options struct like:
type Options struct {
logger *slog.Logger `option:""mandatory"`
}
Options:
- We can just mark this
logger
field with// Deprecated: ...
and create a new field. But in example above (when we havemandatory
mark) we will not see a deprecation marker, because this field will have no setter likeWithLogger
. - ???