清理文件

This commit is contained in:
chai2010
2022-08-04 15:15:13 +08:00
parent 06a1bdf735
commit 3a20d238d9
83 changed files with 25 additions and 63507 deletions

View File

@@ -526,7 +526,7 @@ $ go list -f={{.GoFiles}} fmt
[doc.go format.go print.go scan.go]
```
{% endraw %}
TestGoFiles表示的是fmt包内部测试代码以_test.go为后缀文件名不过只在测试时被构建
@@ -537,7 +537,7 @@ $ go list -f={{.TestGoFiles}} fmt
[export_test.go]
```
{% endraw %}
包的测试代码通常都在这些文件中不过fmt包并非如此稍后我们再解释export_test.go文件的作用。
@@ -550,7 +550,7 @@ $ go list -f={{.XTestGoFiles}} fmt
[fmt_test.go scan_test.go stringer_test.go]
```
{% endraw %}
有时候外部测试包也需要访问被测试包内部的代码例如在一个为了避免循环导入而被独立到外部测试包的白盒测试。在这种情况下我们可以通过一些技巧解决我们在包内的一个_test.go文件中导出一个内部的实现给外部测试包。因为这些代码只有在测试时才需要因此一般会放在export_test.go文件中。