<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:34:31 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[GODRIVER-579] nil context should always default to context.Background</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-579</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;Some API functions allow a nil context, but this is inconsistently documented.&lt;/p&gt;

&lt;p&gt;Others, like cursor.Close do not check for a nil context.&lt;/p&gt;

&lt;p&gt;To assist users who don&apos;t want to explicitly specify context.Background() on all calls, all calls that take a context should check for a nil argument and replace it with context.Background().&lt;/p&gt;

&lt;p&gt;All such functions should also have test coverage added for this case.&lt;/p&gt;</description>
                <environment></environment>
        <key id="607529">GODRIVER-579</key>
            <summary>nil context should always default to context.Background</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="12300">Won&apos;t Do</resolution>
                                        <assignee username="benji.rewis@mongodb.com">Benji Rewis</assignee>
                                    <reporter username="david.golden@mongodb.com">David Golden</reporter>
                        <labels>
                    </labels>
                <created>Thu, 20 Sep 2018 13:54:00 +0000</created>
                <updated>Fri, 14 Oct 2022 14:30:11 +0000</updated>
                            <resolved>Fri, 14 Oct 2022 14:30:11 +0000</resolved>
                                                                    <component>Internal</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4903569" author="benji.rewis" created="Fri, 14 Oct 2022 14:30:11 +0000"  >&lt;p&gt;We do not want to officially support passing nil contexts to any of our API. The&#160;&lt;a href=&quot;https://pkg.go.dev/context#pkg-overview&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;official Go docs&lt;/a&gt;&#160;say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Do not pass a nil Context, even if a function permits it. Pass context.TODO if you are unsure about which Context to use.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;For the sake of posterity: our official policy is that users MUST pass non-nil contexts to any API. We do have some nil checks in the current version of the driver (cursor.Close() calls Close on the underlying batch cursor which &lt;em&gt;does&lt;/em&gt; check for a nil context), and we cannot remove them as that may be backwards-breaking. We will not be adding more of these nil checks, though, as we do not want to encourage users to pass around nil contexts. Furthermore, even if we did add nil context checks to every user-facing function or method that takes a context, maintaining that pattern would be difficult. There is not a community-supported linter for that pattern (and we do not want to maintain one) and maintaining 100% test coverage for nil context checks is not feasible.&lt;/p&gt;</comment>
                            <comment id="2048367" author="jeff.yemin" created="Thu, 1 Nov 2018 00:09:43 +0000"  >&lt;p&gt;No objections.  And no, the ticket doesn&apos;t get assigned to you.&lt;/p&gt;</comment>
                            <comment id="2048296" author="p4tin" created="Wed, 31 Oct 2018 22:22:26 +0000"  >&lt;p&gt;Also I do I get the ticket assigned to me?&lt;/p&gt;</comment>
                            <comment id="2048292" author="p4tin" created="Wed, 31 Oct 2018 22:19:45 +0000"  >&lt;p&gt;I would like to try to take this one on.&#160; Any objections?&#160; So far, in the code that I looked at all the changes are in the topology package (server.go, cursor.go and topology.go) - have I missed any your comments and directions are welcome.&lt;/p&gt;

&lt;p&gt;I am going to do checks for ctx == nil and set it as required and unit test all the places I changed.&lt;/p&gt;</comment>
                            <comment id="2012636" author="kris.brandow" created="Mon, 24 Sep 2018 20:23:45 +0000"  >&lt;p&gt;While users should ideally never pass a &lt;tt&gt;nil&lt;/tt&gt; context, since we already support this behavior it should be consistent.&lt;/p&gt;</comment>
                            <comment id="2009742" author="david.golden" created="Thu, 20 Sep 2018 20:00:15 +0000"  >&lt;p&gt;client.Disconnect is another case that does not check, but should.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hty3br:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>