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

blob: clearly document cases where blob saves a Context for later use #274

Closed
vangent opened this issue Jul 31, 2018 · 0 comments
Closed
Assignees
Labels
code health Code health task, either refactoring or testing
Milestone

Comments

@vangent
Copy link
Contributor

vangent commented Jul 31, 2018

In at least one case (NewWriter), blob saves a context for later use.

  • ctx is passed to NewWriter
  • If new opt.ContentType is provided, it saves the ctx in the returned *Writer.
  • That ctx may be used later as part of a call to Write or to Close (which don't take a Context argument).

The Context documentation says "Do not store Contexts inside a struct type", so this is kind of a no-no, but I'm not sure how to avoid it. There's a proposal to add Context args to Write and Close, but that's speculative and unlikely to happen soon.

We should at least clearly document the behavior.

@zombiezen zombiezen changed the title Clearly document cases where blob saves a Context for later use blob: clearly document cases where blob saves a Context for later use Aug 1, 2018
@zombiezen zombiezen added the code health Code health task, either refactoring or testing label Aug 1, 2018
@zombiezen zombiezen added this to the Sprint 15 milestone Aug 6, 2018
@shantuo shantuo added the in progress This is being actively worked on label Aug 9, 2018
@vangent vangent removed the in progress This is being actively worked on label Aug 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Code health task, either refactoring or testing
Projects
None yet
Development

No branches or pull requests

3 participants