Conversation
c499020 to
d7c92ef
Compare
|
|
||
| client := getter.DefaultClient | ||
|
|
||
| getters := getter.Getters |
There was a problem hiding this comment.
This looks like a change from the current behavior, where callers can define its own list of getters (client.Getters) and only those clients get set (originally in client_options.go, when it iterates over the getters if not nil). Am I misreading this change?
Here's an example from terraform: https://github.com/hashicorp/terraform/blob/807267d1b56aa6298fecf5edba98c088c2866e83/internal/initwd/getter.go#L131
There was a problem hiding this comment.
On the v2 branch the client was split from the request and the getters are set on the client, so here this line from terraform (link) could become:
var goGetterClient = getter.Client{
Getters: map[string]getter.Getter{
"file": new(getter.FileGetter),
"gcs": new(getter.GCSGetter),
"git": new(getter.GitGetter),
"hg": new(getter.HgGetter),
"s3": new(getter.S3Getter),
"http": getterHTTPGetter,
"https": getterHTTPGetter,
},
}There was a problem hiding this comment.
And the call would be : client.Get(ctx, getter.Request{ /*...*/ })
There was a problem hiding this comment.
I see it now, thank you! Definitely a misread on my part.
|
This looks fine by me (with my "terraform core" hat on)! Since there's a (tiny) breaking change I would like to see that documented or in the changelog, but that's not blocking this PR. Cheers 🎉 |
|
Thanks for your review. Ah I totally forgot about the changelog; I'll draft a PR right away for the whole |
sylviamoss
left a comment
There was a problem hiding this comment.
Looks nice!! I just made a question because you removed something that I use in #240.
| // a GCS bucket. | ||
| type GCSGetter struct { | ||
| getter |
There was a problem hiding this comment.
Why did you remove this? 🤔
I'm asking because the SmbGetter is using this to check if there's an available FileGetter. We need to check that In case the user doesn't want to provide the FileGetter and then SmbGetter can't use it.
There was a problem hiding this comment.
Ah, good question, I removed it because it is unused and is a bad pattern.
I initially added it in the master branch where the client/request are the same object. It would have allowed to reuse the getters of a request to do things like downloading the checksum from a file. It turns out it was not used.
I think this pattern was pretty bad and was going away from the initial design of this library which was aiming at avoiding a getter from knowing about the client ( so separating the concerns ).
Now if the SmbGetter needs this; let's pause a minute to think a little more; I need to re-read your PR with that in mind.
6f037bb to
b9074f1
Compare
to not force importers to import 3rd party getters and dependencies
|
Okay, merging this one ! Thanks everyone, we are not quite ready to tag this yet so there's probably time to fix/change things around. |
This PR creates the following submodules for the go-getter:
Some testing helpers were used everywhere so I put them in
"helper/testing". I also added the"helper/url".MustParsefunction that is used everywhere. Other than that what's unexported is still unexported.This PR replaces #238 so that we can see circle-ci's results and this uses #241 too to avoid divergences.
close #193