-
Notifications
You must be signed in to change notification settings - Fork 503
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
Conversation
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.
@marwan-at-work one comment
pkg/download/goget/goget.go
Outdated
} | ||
|
||
return v.Zip, nil | ||
} |
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.
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?
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.
@arschles I am. Line 162 above in this function
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 take this back completely - I see you are using the Fetcher and Ref!
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.
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
pkg/download/goget/goget.go
Outdated
} | ||
|
||
return v.Zip, nil | ||
} |
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 take this back completely - I see you are using the Fetcher and Ref!
Ref #290 - this doesn't synchronously do cache fills but it's related because it's listing tags synchronously |
cmd/proxy/actions/app_proxy.go
Outdated
@@ -16,8 +17,9 @@ func addProxyRoutes( | |||
) error { | |||
app.GET("/", proxyHomeHandler) | |||
|
|||
dp := goget.New() |
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.
A nonsense nit but maybe gg
, I guess dp
was download protocol?
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.
@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.
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.
And by magic, I don't really mean magic in the meta programming sense lol
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.
That makes more sense, knowing there might be other implementations of the download protocol
f2030bc
to
66b2be1
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.
this is looking great. I only have nits, all of which we can address in a follow-up. Merge when you feel comfortable
pkg/download/download.go
Outdated
"github.com/gomods/athens/pkg/storage" | ||
) | ||
|
||
// Protocol is the download protocol defined by cmd/go |
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.
defined by cmd/go
do you mean that this is taken from cmd/go
?
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.
Sorry the wording is definitely misleading. I meant they mirror the HTTP requests that cmd/go expects to use. I'll update the comment.
pkg/download/goget/goget.go
Outdated
return errors.E(op, err) | ||
} | ||
return nil | ||
} |
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 code would be super useful in the Fetcher.Fetch
method. can we move it down to there and then make list use it?
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.
@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. |
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.
sounds like a great idea! mind creating an issue for it?
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.
yep
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.
Can we update the comment to ref: #340
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
da0707e
to
710ba72
Compare
pkg/download/goget/goget.go
Outdated
if err != nil { | ||
return nil, errors.E(op, err) | ||
} | ||
defer v.Zip.Close() |
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.
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], |
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.
Should the name and the short name be the same? I'm not familiar.
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.
@robjloranger the name is meant to be the full sha. But it should work with the short version. I'm currently testing that.
pkg/download/goget/goget.go
Outdated
if err != nil { | ||
return nil, errors.E(op, err) | ||
} | ||
defer v.Zip.Close() |
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.
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. |
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.
Will this be in this PR?
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.
Probably after
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.
Looks great, little comments and questions but not important. Do we need/want an issue for removing the error from the NewGoGetFetcher
function signature?
@robjloranger I removed that error in #337, but if you create an issue let me know and I'll mention it in that PR |
No worries then @arschles, just wanted to make sure it didn't go missed. |
3a7e93d
to
79a5d67
Compare
@carolynvs, @marwan-at-work and @Kunde21 discussed this PR on a screenshare. we are merging now, and doing follow-up refactors in #337 🎉 |
No description provided.