Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Adding size sorting for package and file differs/analyzers #36

Merged
merged 9 commits into from
Aug 23, 2017

Conversation

cftorres
Copy link
Contributor

type StrPackageInfo struct {
type PackageOutput struct {
Name string
Path string `json:",omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a little strange to me, should that comma be there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, because prior to the comma should go the field name you want displayed, but if if you don't specify anything, it defaults to the struct's field name, and I'm just keeping it the same here


func (r DirDiffResult) GetStruct() DiffResult {
func (r DirDiffResult) OutputStruct() interface{} {
r.Diff = sortDirDiff(r.Diff.(DirDiff))
Copy link
Contributor

Choose a reason for hiding this comment

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

error check for this type cast?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


// Sorts MultiVersionInfos by package instance with the largest size in the first image, in descending order
var singleInfoSizeSort = func(a, b *Info) bool {
aInfo1 := a.Info1
Copy link
Contributor

Choose a reason for hiding this comment

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

are these variable assignments necessary?

}

func (s *multiVersionInfoSorter) Swap(i, j int) {
s.packageDiffs[i], s.packageDiffs[j] = s.packageDiffs[i], s.packageDiffs[j]
Copy link
Contributor

Choose a reason for hiding this comment

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

unless I'm missing something here, you have these backwards

}

func (s *entryDiffSorter) Swap(i, j int) {
s.entryDiffs[i], s.entryDiffs[j] = s.entryDiffs[i], s.entryDiffs[j]
Copy link
Contributor

Choose a reason for hiding this comment

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

these are backwards as well I believe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, my bad... fixed now.

@nkubala
Copy link
Contributor

nkubala commented Aug 23, 2017

can you draft a new release in Github and put this in the release notes? don't want to forget to mention this :)

@cftorres
Copy link
Contributor Author

will do :) this and single image analysis i guess?

@cftorres cftorres merged commit 7c0485b into GoogleContainerTools:master Aug 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add sorting of diff/analysis output by size
2 participants