Skip to content

Commit

Permalink
Deployed 88830e8 to v2.49 with MkDocs 1.6.1 and mike 2.2.0.dev0
Browse files Browse the repository at this point in the history
  • Loading branch information
vektra-bot committed Nov 21, 2024
1 parent be5ff07 commit ecffb29
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
30 changes: 23 additions & 7 deletions v2.49/deprecations/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -887,29 +887,45 @@

<h1 id="deprecations">Deprecations<a class="headerlink" href="#deprecations" title="Permanent link">&para;</a></h1>
<h2 id="packages"><code>packages</code><a class="headerlink" href="#packages" title="Permanent link">&para;</a></h2>
<div class="admonition tip">
<p>To resolve this warning, use the <a href="../features/#packages-configuration"><code>packages</code></a> feature:</p>
<div class="highlight"><span class="filename">.mockery.yaml</span><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nt">packages</span><span class="p">:</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="w"> </span><span class="p p-Indicator">[</span><span class="nv">...</span><span class="p p-Indicator">]</span>
</code></pre></div>
</div>
<p>The <a href="../features/#packages-configuration"><code>packages</code></a> feature will be the only way to configure mockery in the future.</p>
<h2 id="issue-845-fix"><code>issue-845-fix</code><a class="headerlink" href="#issue-845-fix" title="Permanent link">&para;</a></h2>
<div class="admonition tip">
<p>To resolve this warning:</p>
<div class="highlight"><span class="filename">.mockery.yaml</span><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span class="nt">issue-845-fix</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">True</span>
</code></pre></div>
</div>
<p>This parameter fixes a somewhat uninteresting, but important issue found in <a href="https://github.com/vektra/mockery/issues/845">#845</a>.
In short, mockery ignored the <code class="highlight"><span class="nt">outpkg</span><span class="p">:</span></code> parameter if <code class="highlight"><span class="nt">inpackage</span><span class="p">:</span></code> was set to <code class="highlight"><span class="l l-Scalar l-Scalar-Plain">True</span></code>. This prevents users
from being able to set alternate package names for their mocks that are generated in the same directory
as the mocked interface. For example, it's legal Go to append <code>_test</code> to the mock package name
if the file is appended with <code>_test.go</code> as well. This parameter will be permanently
enabled in mockery v3.</p>
<p>As an example, if you had configuration that looked like this:</p>
<div class="highlight"><span class="filename">YAML</span><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nt">all</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">True</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="nt">dir</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;{{.InterfaceDir}}&quot;</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="nt">mockname</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;{{.InterfaceName}}Mock&quot;</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span class="nt">outpkg</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;{{.PackageName}}_test&quot;</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="nt">filename</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;mock_{{.InterfaceName}}_test.go&quot;</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a><span class="nt">inpackage</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">True</span>
<div class="highlight"><span class="filename">YAML</span><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a><span class="nt">all</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">True</span>
<a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a><span class="nt">dir</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;{{.InterfaceDir}}&quot;</span>
<a id="__codelineno-2-3" name="__codelineno-2-3" href="#__codelineno-2-3"></a><span class="nt">mockname</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;{{.InterfaceName}}Mock&quot;</span>
<a id="__codelineno-2-4" name="__codelineno-2-4" href="#__codelineno-2-4"></a><span class="nt">outpkg</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;{{.PackageName}}_test&quot;</span>
<a id="__codelineno-2-5" name="__codelineno-2-5" href="#__codelineno-2-5"></a><span class="nt">filename</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;mock_{{.InterfaceName}}_test.go&quot;</span>
<a id="__codelineno-2-6" name="__codelineno-2-6" href="#__codelineno-2-6"></a><span class="nt">inpackage</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">True</span>
</code></pre></div>
<p>The <code class="highlight"><span class="l l-Scalar l-Scalar-Plain">outpkg</span></code> parameter would not be respected and instead would be forced to take on the value of <code class="highlight"><span class="s">&quot;{{.PackageName}}&quot;</span></code>.
To remove the warning, you must set:</p>
<div class="highlight"><span class="filename">YAML</span><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span class="nt">issue-845-fix</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">True</span>
<div class="highlight"><span class="filename">YAML</span><pre><span></span><code><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a><span class="nt">issue-845-fix</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">True</span>
</code></pre></div>
<p>After this is done, mocks generated in the old scheme will properly respect the <code class="highlight"><span class="nt">outpkg</span><span class="p">:</span></code> parameter previously set
if being generated with <code class="highlight"><span class="nt">inpackage</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">True</span></code>.</p>
<h2 id="resolve-type-alias"><code>resolve-type-alias</code><a class="headerlink" href="#resolve-type-alias" title="Permanent link">&para;</a></h2>
<div class="admonition tip">
<p>To resolve this warning:</p>
<div class="highlight"><span class="filename">.mockery.yaml</span><pre><span></span><code><a id="__codelineno-4-1" name="__codelineno-4-1" href="#__codelineno-4-1"></a><span class="nt">resolve-type-alias</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">False</span>
</code></pre></div>
</div>
<p>This parameter directs Mockery on whether it should resolve a type alias to its underlying, real
type or if it should generate mocks by referencing. Mockery was changed in <a href="https://github.com/vektra/mockery/pull/808">#808</a>
to support a new language feature that exposed type aliases in the parsed syntax tree. This meant
Expand Down
2 changes: 1 addition & 1 deletion v2.49/search/search_index.json

Large diffs are not rendered by default.

0 comments on commit ecffb29

Please sign in to comment.