This commit is contained in:
github-actions[bot]
2022-10-20 06:05:49 +00:00
parent 441913e7e5
commit 293c16fd2d
5 changed files with 6 additions and 6 deletions

View File

@@ -174,7 +174,7 @@ default:
panic(fmt.Sprintf("invalid suit %q", s)) // Joker?
}
</code></pre>
<p>断言函数必须满足的前置条件是明智的做法,但这很容易被滥用。除非你能提供更多的错误信息,或者能更快速的发现错误,否则不需要使用断言,编译器在运行时会帮你检查代码</p>
<p>断言函数必须满足的前置条件是明智的做法,但这很容易被滥用。除非你能提供更多的错误信息,或者能更快速的发现错误,否则不需要断言那些运行时会检查的条件</p>
<pre><code class="language-Go">func Reset(x *Buffer) {
if x == nil {
panic(&quot;x is nil&quot;) // unnecessary!