Skip to content
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

impl Default for Os and Arch, use in ImageConfiguration::default() #90

Merged
merged 2 commits into from
Jan 17, 2022

Conversation

cgwalters
Copy link
Contributor

Hardcoding Linux/x86_64 is a trap because it will silently do the
right thing only for users on that platform.

Closes: #88

…lt()`

Hardcoding Linux/x86_64 is a trap because it will silently do the
right thing only for users on that platform.

Closes: youki-dev#88
@@ -227,6 +227,12 @@ impl<'de> Deserialize<'de> for Os {
}
}

impl Default for Os {
fn default() -> Self {
Os::from(std::env::consts::OS)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I spot checked this and it seems like there's enough overlap with what Rust has in https://doc.rust-lang.org/std/env/consts/constant.OS.html and what OCI (really Go I guess) expects.

OK I just got a link to https://github.com/containerd/containerd/blob/140ecc9247386d3be21616fe285021c081f4ea08/platforms/database.go#L83
which seems to be a key player in this.

Since we can, and this silences a clippy warning.
@codecov-commenter
Copy link

Codecov Report

Merging #90 (5c01984) into main (2440343) will increase coverage by 0.32%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##             main      #90      +/-   ##
==========================================
+ Coverage   25.26%   25.59%   +0.32%     
==========================================
  Files          20       20              
  Lines        1488     1481       -7     
  Branches      714      706       -8     
==========================================
+ Hits          376      379       +3     
+ Misses        469      463       -6     
+ Partials      643      639       -4     

Copy link
Contributor

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

LGTM

@saschagrunert saschagrunert merged commit b10f910 into youki-dev:main Jan 17, 2022
@cgwalters
Copy link
Contributor Author

cgwalters commented Jan 17, 2022

Actually it turns out there was a bug related to powerpc here, #91

This was referenced Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImageConfiguration::default() is a trap
3 participants