Skip to content

Add demo 'disk show' command to show human friendly output, sort partition output. - #62

Merged
smoser merged 2 commits into
project-machine:masterfrom
smoser:feature/demo-disk-show
Apr 15, 2020
Merged

Add demo 'disk show' command to show human friendly output, sort partition output.#62
smoser merged 2 commits into
project-machine:masterfrom
smoser:feature/demo-disk-show

Conversation

@smoser

Copy link
Copy Markdown
Collaborator

2 things here:

  • Sort output of disk.Details by partition number. Previously these were just map-ordered (non-ordered)
  • Add demo disk show.

Scott Moser added 2 commits April 10, 2020 15:04
In Details() output, partitions were not guaranteed in any order.
This puts them in partition number order. Note that that is not
necessarily the order on disk.
Demo disk show prints the human friendly version of 'demo disk scan'.
@codecov

codecovBot commented Apr 10, 2020

Copy link
Copy Markdown

Codecov Report

Merging #62 into master will increase coverage by 0.07%.
The diff coverage is 83.33%.

Impacted file tree graph

@@ Coverage Diff @@## master #62 +/- ##
==========================================
+ Coverage 56.54% 56.61% +0.07% 
==========================================
Files 15 15 Lines 1657 1662 +5 ==========================================
+ Hits 937 941 +4 
Misses 651 651 - Partials 69 70 +1 
Impacted FilesCoverage Δ
disk.go86.80% <83.33%> (-0.25%)⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a68a034...49b9059. Read the comment docs.

Comment threaddisk.go
pNums = append(pNums, n)
}

sort.Slice(pNums, func(i, j int) bool { return pNums[i] < pNums[j] })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm, you could save yourself this dance if you used an int with IntSlice: https://golang.org/pkg/sort/#IntSlice

Not sure if you really need uint or not.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

yeah, but I don't have an int. maybe I was being pedantic, but a partition number is an unsigned int, because it can't be < 0. (0 <= n <= 127 ... I think 127).

So I think this is about the shortest dance I can do to sort that.

@smosersmoser mentioned this pull request Apr 15, 2020
@smoser
smoser merged commit 0a9d1bb into project-machine:masterApr 15, 2020
@smoser
smoser deleted the feature/demo-disk-show branch April 15, 2020 13:44
Sign up for freeto 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.

2 participants

@smoser@tych0