Conversation
|
Will this be merged in anytime soon? Would be specifically useful for authorization. |
|
@IamFlowZ you can try my fork |
query.go
Outdated
| // Named type. E.g., "Int". | ||
| name := t.Name() | ||
| if name == "string" { // HACK: Workaround for https://github.com/shurcooL/githubv4/issues/12. | ||
| if name == "string" { // HACK: Workaround for https://github.com/shurcooL/githubv4/issues/12 |
There was a problem hiding this comment.
Could you @Laisky not include unnecessary changes like this?
|
|
||
| // NewClient creates a GraphQL client targeting the specified GraphQL server URL. | ||
| // If httpClient is nil, then http.DefaultClient is used. | ||
| func NewClient(url string, httpClient *http.Client) *Client { |
There was a problem hiding this comment.
Changing a function's signature is a very bad idea for backward compatibility. It's better to create a new function and have the old call the new. A blog entry from the Go team discusses this here: https://blog.golang.org/module-compatibility
There was a problem hiding this comment.
just add some option args, not change the function's behavior.
There was a problem hiding this comment.
Correct, you changed the function's signature. By adding args to the function, you broke backward compatibility. See the blog post from the Go team that I linked in the original message. You should never change a function's signature in a module unless you're doing a major version release with breaking changes, and even then, try to avoid it.
There was a problem hiding this comment.
you broke backward compatibility
it not broke the backward compatibility. I add option args, you can just ignore these args.
There was a problem hiding this comment.
The change here is to add a variadic, old implementations will not break. How is this a breaking change?
There was a problem hiding this comment.
Laisky, again, you changed the function's signature. Please see the provided reference on how it is a breaking change. The blog post from the Go team explains how it's a breaking change when you add args to an exported function. From the provided link "Often, breaking changes come in the form of new arguments to a function." https://blog.golang.org/module-compatibility they also cover how to add arguments to an exported function without making it a breaking change. Don't change a function's signature if you don't need to..
There was a problem hiding this comment.
I add an new method called NewClientWithOptions
5d5da9b to
52aa802
Compare
|
This is a great feature, but I would also prefer it if these were on a new method like |
Laisky
left a comment
There was a problem hiding this comment.
This is a great feature, but I would also prefer it if these were on a new method like
NewClientWithOptionsor something.
good idea
|
|
||
| // NewClient creates a GraphQL client targeting the specified GraphQL server URL. | ||
| // If httpClient is nil, then http.DefaultClient is used. | ||
| func NewClient(url string, httpClient *http.Client) *Client { |
There was a problem hiding this comment.
I add an new method called NewClientWithOptions
StevenACoffman
left a comment
There was a problem hiding this comment.
Thanks! I had a minor suggestion. (also, I'm not a maintainer, but would love to see this merged)
Co-authored-by: Steve Coffman <StevenACoffman@users.noreply.github.com>
|
Not a 1:1 replacement, but #73 might also enable this use case |
|
When is this going to be merged? |
|
will this be merged ? |
can set http client's headers and cookies
fully backwards-compatible.