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

download: add list from go cli #336

Merged
merged 6 commits into from
Jul 27, 2018
Merged

Conversation

marwan-at-work
Copy link
Contributor

No description provided.

@marwan-at-work marwan-at-work requested a review from arschles July 26, 2018 20:35
Copy link
Member

@arschles arschles left a comment

Choose a reason for hiding this comment

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

@marwan-at-work one comment

}

return v.Zip, nil
}
Copy link
Member

Choose a reason for hiding this comment

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

the code in this file looks very similar to the ./pkg/module/go_get_fetcher.go and disk_ref.go - any way you could build the goget protocol on top of those two primitives?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@arschles I am. Line 162 above in this function

Copy link
Member

Choose a reason for hiding this comment

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

I take this back completely - I see you are using the Fetcher and Ref!

Copy link
Member

@arschles arschles left a comment

Choose a reason for hiding this comment

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

Any chance you could add some tests for the goget protocol?

If you can do it for the list handler as well, that'd be rad but it is outside the scope of this PR so I don't think we should block on that

}

return v.Zip, nil
}
Copy link
Member

Choose a reason for hiding this comment

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

I take this back completely - I see you are using the Fetcher and Ref!

@arschles
Copy link
Member

Ref #290 - this doesn't synchronously do cache fills but it's related because it's listing tags synchronously

@@ -16,8 +17,9 @@ func addProxyRoutes(
) error {
app.GET("/", proxyHomeHandler)

dp := goget.New()
Copy link

Choose a reason for hiding this comment

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

A nonsense nit but maybe gg, I guess dp was download protocol?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@robjloranger yeah dp for download protocol because the handlers don't care what the implementation is (go get, github, storage, etc) -- I think it would be really cool if in the very near future we made one download.Protocol interface that will do most of the magic for us: go get, storage, cache filling, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And by magic, I don't really mean magic in the meta programming sense lol

Copy link

Choose a reason for hiding this comment

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

That makes more sense, knowing there might be other implementations of the download protocol

Copy link
Member

@arschles arschles left a comment

Choose a reason for hiding this comment

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

this is looking great. I only have nits, all of which we can address in a follow-up. Merge when you feel comfortable

"github.com/gomods/athens/pkg/storage"
)

// Protocol is the download protocol defined by cmd/go
Copy link
Member

Choose a reason for hiding this comment

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

defined by cmd/go

do you mean that this is taken from cmd/go?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry the wording is definitely misleading. I meant they mirror the HTTP requests that cmd/go expects to use. I'll update the comment.

return errors.E(op, err)
}
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

this code would be super useful in the Fetcher.Fetch method. can we move it down to there and then make list use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@arschles this is already there, I just copied it over. Should I export the function from that package?

// so we can get reproducible results from live VCS repos.
// For now, I cannot test that github.com/pkg/errors returns v0.8.0
// from goget.Latest, because they could very well introduce a new tag
// in the near future.
Copy link
Member

Choose a reason for hiding this comment

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

sounds like a great idea! mind creating an issue for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

Copy link

Choose a reason for hiding this comment

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

Can we update the comment to ref: #340

@codecov-io
Copy link

codecov-io commented Jul 27, 2018

Codecov Report

Merging #336 into master will decrease coverage by 0.28%.
The diff coverage is 31.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #336      +/-   ##
==========================================
- Coverage   37.64%   37.36%   -0.29%     
==========================================
  Files         102      104       +2     
  Lines        2757     2858     +101     
==========================================
+ Hits         1038     1068      +30     
- Misses       1615     1681      +66     
- Partials      104      109       +5
Impacted Files Coverage Δ
pkg/errors/kinds.go 0% <0%> (ø)
cmd/olympus/actions/app.go 80.95% <100%> (+0.22%) ⬆️
cmd/proxy/actions/app_proxy.go 100% <100%> (ø) ⬆️
pkg/download/goget/goget.go 29.03% <29.03%> (ø)
pkg/module/go_get_fetcher.go 49.46% <37.5%> (-1.1%) ⬇️

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 8ef9d7f...4379bcd. Read the comment docs.

if err != nil {
return nil, errors.E(op, err)
}
defer v.Zip.Close()
Copy link

Choose a reason for hiding this comment

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

It's kind of the same thing but you could probably just call Close as the zip is never used.

return nil, errors.E(op, fmt.Errorf("malformed pseudoInfo %v", lr.Version))
}
return &storage.RevInfo{
Name: pseudoInfo[2],
Copy link

Choose a reason for hiding this comment

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

Should the name and the short name be the same? I'm not familiar.

Copy link
Contributor Author

@marwan-at-work marwan-at-work Jul 27, 2018

Choose a reason for hiding this comment

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

@robjloranger the name is meant to be the full sha. But it should work with the short version. I'm currently testing that.

if err != nil {
return nil, errors.E(op, err)
}
defer v.Zip.Close()
Copy link

Choose a reason for hiding this comment

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

Same as with Info, could just close zip now as it's not used.


for _, tc := range tt {
t.Run(tc.name, func(t *testing.T) {
_, err := dp.List(ctx, tc.mod) // TODO ensure list is correct per TODO above.
Copy link

Choose a reason for hiding this comment

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

Will this be in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably after

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Looks great, little comments and questions but not important. Do we need/want an issue for removing the error from the NewGoGetFetcher function signature?

@arschles
Copy link
Member

@robjloranger I removed that error in #337, but if you create an issue let me know and I'll mention it in that PR

@ghost
Copy link

ghost commented Jul 27, 2018

No worries then @arschles, just wanted to make sure it didn't go missed.

@arschles
Copy link
Member

@carolynvs, @marwan-at-work and @Kunde21 discussed this PR on a screenshare. we are merging now, and doing follow-up refactors in #337

🎉

@arschles arschles merged commit 7b590b1 into gomods:master Jul 27, 2018
@marwan-at-work marwan-at-work deleted the betterlist branch August 3, 2018 21:54
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.

3 participants