-
Notifications
You must be signed in to change notification settings - Fork 79
distro: set distro.ID in DistroYAML by loader
#1688
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
Conversation
2db6ed3 to
ad22c3a
Compare
achilleas-k
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but the linter is unhappy.
ad22c3a to
a090d5f
Compare
supakeen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The YAML linter seems to be complaining about a file you didn't touch.
a090d5f to
ae769eb
Compare
By setting the parsed distro.ID into DistroYAML we can simplify a lot of the cases where we currently use `nameVer string` for the various helpers. By using the id we avoid re-parsing the name and potentially raising error. This will simplify the code in the comming commits.
We use(d) `distroNameVer` a lot when accessing YAML data because that is what we had when transitioning from fedora/rhel distro abstraction to the generic distro. But now that everything is a generic distro we can actually use `distro.ID` everywhere which simplifies a lot of code and avoids (re)parsing the `distroNameVer`.
ae769eb to
5c227f2
Compare
thozza
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing! Thanks for figuring this out.
| dist, err := defs.NewDistroYAML("fedora-43") | ||
| require.NoError(t, err) | ||
| assert.Equal(t, &defs.DistroYAML{ | ||
| assert.Equal(t, dist, &defs.DistroYAML{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: technically, the dist should be the third argument to Equal(), because the second is the "expected" value and the third is the "actual" value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! Thank you, I will fix this in a followup (usually I get this right but sometimes I forget :)
distro: set
distro.IDinDistroYAMLby loaderBy setting the parsed distro.ID into DistroYAML we can
simplify a lot of the cases where we currently use
nameVer stringfor the various helpers. By using theid we avoid re-parsing the name and potentially raising
error. This will simplify the code in the comming commits.
distro: add/use
DistroYAML.IDconsistentlyWe use(d)
distroNameVera lot when accessing YAMLdata because that is what we had when transitioning
from fedora/rhel distro abstraction to the generic
distro. But now that everything is a generic distro
we can actually use
distro.IDeverywhere whichsimplifies a lot of code and avoids (re)parsing
the
distroNameVer.