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

pkg/acpi: lift loop condition and remove Sprintf #2851

Merged
merged 2 commits into from
Jan 13, 2024
Merged

Conversation

binjip978
Copy link
Contributor

No description provided.

Signed-off-by: Siarhiej Siemianczuk <pdp.eleven11@gmail.com>
Copy link

codecov bot commented Jan 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (00ccdc3) 75.69% compared to head (2327331) 75.69%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2851   +/-   ##
=======================================
  Coverage   75.69%   75.69%           
=======================================
  Files         425      425           
  Lines       42855    42853    -2     
=======================================
- Hits        32438    32437    -1     
+ Misses      10417    10416    -1     
Flag Coverage Δ
.-amd64 67.87% <ø> (ø)
cmds/...-amd64 71.73% <ø> (+0.05%) ⬆️
integration/generic-tests/...-amd64 0.00% <ø> (ø)
integration/generic-tests/...-arm 0.00% <ø> (ø)
integration/generic-tests/...-arm64 0.00% <ø> (ø)
integration/gotests/...-amd64 73.95% <100.00%> (-0.01%) ⬇️
integration/gotests/...-arm64 74.89% <0.00%> (+<0.01%) ⬆️
pkg/...-amd64 76.09% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@binjip978 binjip978 added the Awaiting reviewer Waiting for a reviewer. label Jan 13, 2024
Copy link
Member

@rminnich rminnich left a comment

Choose a reason for hiding this comment

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

see my question, I've started doing silly things like this go make sure it will work, but there has to be a better way to do this
var b [4]byte
var data []byte
bytes.NewBuffer(data).Read(b[:])
fmt.Printf("%q\n", string(b[:]))
kinda gross, but safe. is there not some package that does this? I've looked in some of the generic packages but not found it yet. But .. it ought to exist.

still, we've had this package for years, but still ...

pkg/acpi/raw.go Show resolved Hide resolved
@rminnich rminnich added Awaiting author Waiting for new changes or feedback for author. and removed Awaiting reviewer Waiting for a reviewer. labels Jan 13, 2024
@binjip978
Copy link
Contributor Author

var b [4]byte
var data []byte
bytes.NewBuffer(data).Read(b[:])
fmt.Printf("%q\n", string(b[:]))

What the difference with this snippet:

data := make([]byte, 4)
fmt.Printf("%q\n", string(data[:]))

We will got "\x00\x00\x00\x00" in both cases?

@binjip978 binjip978 added Awaiting reviewer Waiting for a reviewer. and removed Awaiting author Waiting for new changes or feedback for author. labels Jan 13, 2024
@rminnich
Copy link
Member

The only difference: try it with
var b [0]byte
var data []byte
bytes.NewBuffer(data).Read(b[:])
fmt.Printf("%q\n", string(b[:]))

Copy link
Member

@rminnich rminnich left a comment

Choose a reason for hiding this comment

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

it's a google tradition in a PR to ask you to fix stuff somebody else wrote wrong :-)

@binjip978 binjip978 merged commit 1540d3a into u-root:main Jan 13, 2024
25 checks passed
@binjip978 binjip978 deleted the acpi branch January 13, 2024 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting reviewer Waiting for a reviewer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants