英文:
Golang-too many arguments
问题
我尝试测试它,但出错了。
<https://github.com/awesome-cmd/dchat/blob/3cf074d33e6be93596ba8484eff4a5152dd1307b/client/spi_test.go#L10>
package server
import "testing"
func TestRun(t *testing.T) {
Run([]string{"3333"})
}
vscode
返回:
{
"resource": "GitHub/dchat/client/spi_test.go",
"owner": "_generated_diagnostic_collection_name_#2",
"severity": 8,
"message": "参数过多",
"source": "compiler",
"startLineNumber": 10,
"startColumn": 6,
"endLineNumber": 10,
"endColumn": 6
}
请帮助我。
英文:
I try to test it,but wrong.
<https://github.com/awesome-cmd/dchat/blob/3cf074d33e6be93596ba8484eff4a5152dd1307b/client/spi_test.go#L10>
package server
import "testing"
func TestRun(t *testing.T) {
Run([]string{"3333"})
}
vscode
return :
{
"resource": "GitHub/dchat/client/spi_test.go",
"owner": "_generated_diagnostic_collection_name_#2",
"severity": 8,
"message": "too many arguments",
"source": "compiler",
"startLineNumber": 10,
"startColumn": 6,
"endLineNumber": 10,
"endColumn": 6
}
Please help me.
答案1
得分: -1
你的Run()
函数没有定义任何参数。
尝试使用func Run(list []string)
。
你在为你的项目编写测试方面做得很好。
英文:
Your Run()
does not have any parameters defined.
Try func Run(list []string)
Good job on writing tests for your project.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论