Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

osversion: Add Parse function and make partially cross-platform #2019

Closed
wants to merge 2 commits into from

Conversation

vvoland
Copy link

@vvoland vvoland commented Feb 6, 2024

address: #2018

osversion: Add Parse function

Add function that parses the string representation back to the OSVersion struct.

osversion: Make OSVersion cross-platform

Move non-Windows dependent code outside of the windows build tagged files. This makes it possible to use the version parse/stringifying code on non-Windows platforms and keep the code that interacts with Windows API only for the Windows builds.

osversion/osversion.go Outdated Show resolved Hide resolved
return osv
}

// Parse parses a string representation of OSVersion.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we could add an example input value to outline the expected format (if there's a reference link somewhere, I guess that could be useful, but not strictly necessary).

@vvoland vvoland force-pushed the osversion-parse branch 2 times, most recently from c8b6a9f to 95bc44c Compare February 6, 2024 14:14
osversion/osversion.go Outdated Show resolved Hide resolved
Move non-Windows dependent code outside of the `windows` build tagged
files. This makes it possible to use the version parse/stringifying code
on non-Windows platforms and keep the code that interacts with Windows
API only for the Windows builds.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Add function that parses the string representation back to the OSVersion
struct.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@kiashok
Copy link
Contributor

kiashok commented Feb 6, 2024

address: #2018

osversion: Add Parse function

Add function that parses the string representation back to the OSVersion struct.

osversion: Make OSVersion cross-platform

Move non-Windows dependent code outside of the windows build tagged files. This makes it possible to use the version parse/stringifying code on non-Windows platforms and keep the code that interacts with Windows API only for the Windows builds.

Added a comment to the github issue #2018 so all the discussion is in one place for future reference as well :)

@ambarve
Copy link
Contributor

ambarve commented Apr 2, 2024

Closing this based on the discussion at #2018. Can discuss this further on the github issue if required.

@ambarve ambarve closed this Apr 2, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants