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

Odd location for UnMarshal #19

Closed
endophage opened this issue Jan 22, 2015 · 5 comments
Closed

Odd location for UnMarshal #19

endophage opened this issue Jan 22, 2015 · 5 comments
Labels
frozen due to age Issues that have been left open but haven't received comments in more than six months will be closed Improvement

Comments

@endophage
Copy link

First, great work, just came across this in the golang weekly newsletter and I've felt your pain re. authenticating with other services.

Obviously down to individual developer's opinions but it feels like Provider.UnmarshalSession should really be an initialization function for Session objects in the provider's session.go, not least of all because its symmetrical partner, Session.Marshal is on the Session. UnmarshalSession makes no use of the Provider instance it is passed so at the very least (and it's a non-breaking change), it shouldn't be a Provider pointer but a Provider object in the signature, to make it clear the function doesn't modify the Provider instance it is called on.

I'm guessing you've put it on the Provider so you can include it in the interface and enforce the interface for other providers people write. In that case, I guess I'm saying it seems to make more sense on the Session if it has to be an instance method.

@markbates
Copy link
Owner

Open a PR with the changes you're suggesting if it makes sense I'll merge it in.

@rakesh-eltropy
Copy link
Collaborator

Moved UnmarshalSession method in Session.

@zmb3
Copy link
Contributor

zmb3 commented Mar 16, 2016

I think the intent of the issue was not that we need to cut and paste the UnmarshalSession method into a different file, but that the method should not be on the Provider type.

As mentioned, the UnmarshalSession method doesn't even use it's *Provider receiver, and it doesn't make sense to have Marshal in the Session interface and unmarshal in the Provider type.

@rakesh-eltropy
Copy link
Collaborator

Sorry, It was a mistake. I rollbacked it.

@bentranter bentranter added the frozen due to age Issues that have been left open but haven't received comments in more than six months will be closed label Oct 11, 2018
@bentranter
Copy link
Collaborator

Closing this due to age, feel free to re-open if it's still an issue.

dvic pushed a commit to dvic/goth that referenced this issue Feb 8, 2021
As pointed out in markbates#19, there are cases where the scopes returned from
the /scopes call don't include the scope(s) we need. This is because
there are catch-all scopes that give access to the necessary APIs even
without the explicit scope we've asked for.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frozen due to age Issues that have been left open but haven't received comments in more than six months will be closed Improvement
Projects
None yet
Development

No branches or pull requests

5 participants