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

Fix two query API bugs #521

Merged
merged 1 commit into from
Sep 6, 2018
Merged

Fix two query API bugs #521

merged 1 commit into from
Sep 6, 2018

Conversation

mdittmer
Copy link
Contributor

@mdittmer mdittmer commented Sep 5, 2018

  1. gzip reader/writers do not close their delegates
    1. Wrap in new compositeReadWriteCloser
  2. *memcacheWriteCloser ptr type (not memcacheWriteCloser value type) should be io.WriteCloser

1. `gzip` reader/writers do not close their delegates
  1. Wrap in new `compositeReadWriteCloser`
1. `*memcacheWriteCloser` ptr type (not `memcacheWriteCloser` value type) should be `io.WriteCloser`
@mdittmer mdittmer requested a review from Hexcles September 5, 2018 18:57
@Hexcles
Copy link
Member

Hexcles commented Sep 5, 2018

@wpt-pr-bot
Copy link

Staging instance deployed by Travis CI!
Running at https://query-cache-fixes-dot-wptdashboard-staging.appspot.com

@lukebjerring lukebjerring merged commit 225cbae into master Sep 6, 2018
@lukebjerring lukebjerring deleted the query-cache-fixes branch September 6, 2018 13:32
Copy link
Member

@Hexcles Hexcles left a comment

Choose a reason for hiding this comment

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

A late comment just FYI. Otherwise, LGTM.

@@ -97,17 +135,17 @@ func (mc memcacheReadWritable) NewReadCloser(key string) (io.ReadCloser, error)
}

func (mc memcacheReadWritable) NewWriteCloser(key string) (io.WriteCloser, error) {
Copy link
Member

Choose a reason for hiding this comment

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

@mdittmer I know you've merged the PR but still want to share a thought on this:

The fact that changing the return value doesn't change the function signature reminds me of a Go convention that we didn't follow here: take interfaces as arguments, and return concrete types. In this example, we should return *memcacheWriteCloser. Explicitness in return values benefits the callers (and callers don't have to care - they can always use := or even assign the return value to an interface type), while the polymorphism in arguments makes the function more generic.

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.

4 participants