在VScode中具有go扩展名后,对方法进行基准测试只需单击一下,[run benchmark]然后立即在vscode控制台中将其输出,然后是运行的命令和输出:
Running tool: /usr/local/bin/go test -benchmem -run=^$ github.com/zyxan/benchmarks -bench ^BenchmarkRandomStringGeneration2$
goos: darwin
goarch: amd64
pkg: github.com/zyxan/benchmarks
BenchmarkRandomStringGeneration2-4 10000000 147 ns/op 80 B/op 3 allocs/op
PASS
ok github.com/zyxan/benchmarks 1.654s
Success: Benchmarks passed.
现在,如果我想在终端上重现这样的命令,我实际上只是复制它
/usr/local/bin/go test -benchmem -run=^$ github.com/zyxan/benchmarks -bench ^BenchmarkRandomStringGeneration2$
将其粘贴到我的终端会话中会得到以下输出:
❯ /usr/local/bin/go test -benchmem -run=^$ github.com/zyxan/benchmarks -bench ^BenchmarkRandomStringGeneration2$
zsh: no matches found: -run=^$
为什么会引起这种差异?
qq_遁去的一_1
随时随地看视频慕课网APP
相关分类