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
Fix minor formatting issues #2575
Fix minor formatting issues #2575
Conversation
@@ -58,7 +58,7 @@ BIOS_MIB="4" # one per disk | |||
OVERHEAD_MIB="$((GPT_MIB * 2 + BIOS_MIB))" | |||
|
|||
# The 'recommended' size for the EFI partition is 100MB but our EFI images are | |||
# under 1MB, so this will suffice for now. It would be possible to increase the | |||
# under 2MB, so this will suffice for now. It would be possible to increase the |
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.
I have tried to build an image using a 1 MB EFI partition but that failed. Using a 2 MB partition worked fine.
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.
Awesome, a lot of great clean up here. This would get us pretty close to being able to add the mdlint job that we use in some of the other repos.
If you do an update, please address the .gitignore
comment. Otherwise I don't think that's too critical, so while I'd prefer not to have it, I don't think it's a big deal if we include it.
36abbfc
to
d5487d3
Compare
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.
Thanks for the fixes
sources/api/certdog/README.md
Outdated
This text was generated using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/main.rs`. No newline at end of file | ||
This text was generated using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/main.rs`. |
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.
I'm wondering what this change does? It seems like it makes no difference in the rich diff. The reason I ask is because all the READMEs that have this are auto-generated from docstrings from our source code, so I worry that this change won't last when we touch the source in any way.
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.
I'm wondering the same thing: I'm not seeing a change in the GitHub UI and it doesn't appear to be adding a newline at the end?
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.
Yes, it is the newline at EOF. It was missing in many of these files. It is strange the GitHub is not rendering the symbol that it renders in some views.
It's automatically added when I run cargo readme > README.md
. I see that there's a generate-readme
package that is supposed to automatically generate these but I don't know if there's an easy way to invoke this. I suppose it happens at build time. I just built this and there were no changes to the README files.
Here's an alternative way to view the diff: https://github.com/bottlerocket-os/bottlerocket/commit/d5487d348f6bbf1e8c2ea973d0f23441d37d88fc.diff
diff --git a/sources/api/certdog/README.md b/sources/api/certdog/README.md
index 8769328a9c..e87b8418e0 100644
--- a/sources/api/certdog/README.md
+++ b/sources/api/certdog/README.md
@@ -8,4 +8,4 @@ Current version: 0.1.0
## Colophon
-This text was generated using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/main.rs`.
\ No newline at end of file
+This text was generated using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/main.rs`.
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.
Awesome!! 👏🏼 Thanks for the hard work on this one - huge value add!
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, thank you for doing this!
This text was generated from `README.tpl` using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/main.rs`. |
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.
Most of these edits end up being not stable across a run where README.md
is recreated - if I check out your branch and do something like this, the newlines are lost:
cd sources
find -name README.md -delete
export VARIANT=aws-dev
cargo build
To make them permanent, you'd need to change the generate_readme
helper to write the trailing newline, since this is what each crate's build script invokes. The offending code is here:
let mut readme = File::create("README.md").context(error::ReadmeCreateSnafu)?; |
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.
This seems to be a problem in cargo-readme where running cargo readme > README.md
can produce a different result than when using cargo_readme::generate_readme()
😞
There's a call to template.trim_end_matches("\n")
here: https://github.com/livioribeiro/cargo-readme/blob/11ce95834c5ef52922174a22cd91e9d1868cf3d4/src/readme/template.rs#L54
I suspect that when cargo readme
is called a newline is added at the end at some other part of the code.
Anyway, I made a change to generate_readme
to append a newline. Hopefully that is good enough.
It might make sense to try to fix this in cargo-readme, but it looks like there's not much development there anymore. Let me know if you want me to revert these newlines.
d5487d3
to
f2c839b
Compare
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.
Than you for this PR.
I was writing notes on how we generate our readmes before I saw your conversation with @bcressey and your change to the generate_readme function. Thank you for figuring that out.
If you haven't recently, can go into sources and export VARIANT=aws-dev && cargo build
and see that there is no git diff after building?
sources/api/apiclient/README.md
Outdated
This text was generated from `README.tpl` using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/lib.rs`. No newline at end of file | ||
This text was generated from `README.tpl` using [cargo-readme](https://crates.io/crates/cargo-readme), and includes the rustdoc from `src/lib.rs`. |
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.
This would need to be changed in the README.tpl
file if it's a change we care about. I can't tell from this GitHub diff rendering what was changed.
0943be9
to
e6dec0a
Compare
Thanks for the review @webern.
I tried this but I got an error from one package that I'm not running Linux. I assume that when I run the actual build inside of Docker it won't propagate these kinds of things to my git worktree, right? I can run this on a Linux machine later today. |
Yeah, there are Linux things in there and I found it very hard to cross compile from a mac when I tried. This seems to work though. First I perturbed a generated readme file and committed that change. Then I compiled with this (from the root of the Bottlerocket git tree): docker run \
--mount "type=bind,src=$(pwd)/sources,dst=/sources" \
--workdir="/sources" \
--name build-bottlerocket-sources \
--rm \
-e VARIANT=aws-k8s-1.23 \
--user root \
public.ecr.aws/bottlerocket/bottlerocket-sdk-x86_64:v0.28.0 \
cargo build This did show that the README was out-of-sync
|
Thanks @webern. I just ran that and no files changed. 🎉 |
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.
🌋
Thanks!
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.
👏🏼
Shoot, there's a merge conflict now. Would you mind rebasing on the latest from |
e6dec0a
to
50744a4
Compare
@stmcginnis Done! |
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.
Rebase looks good!
Let's get this in! Would be good to have feedback from a few of the folks that had commented earlier, but since this is a holiday week in the US it's probably not worth waiting in the hopes of getting that. Easy enough to follow up with any new PRs if there is anything in these changes that are of concern. |
Issue number:
N/A
Description of changes:
I have been experimenting with Bottlerocket recently and I've been a bit annoyed that when saving some files, my editor often fixes up some whitespaces unrelated to my change, like whitespace at the end of a line or missing newline at the end of files.
I also noticed that some documentation was out of date, and I had
.DS_Store
files showing up in my working tree. So I decided to take a pass to find and fix as many of these small problems as possible in one go and try to get it merged upstream.Please let me know if there's any change you don't agree with and I can revert those changes. Thanks!
Testing done:
I've rendered some of the documentation pages and verified that they still look good. I found some code formatting were using the wrong tag which should now be fixed.
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.