How to run compiled Go test binaries?

WBOY
Release: 2024-02-13 16:21:18
forward
1043 people have browsed it

如何运行编译好的 Go 测试二进制文件?

php editor Xigua will explain to you how to run the compiled Go test binary file. In the Go language, the compiled binary file can be run directly. First, enter the directory where the binary file is located through the command line. Then, enter the name of the binary file and press Enter to run it. If you need to pass parameters, you can add parameters after the binary file name. During the running process, you can view the output results on the command line. This way, you can run and test compiled Go binaries smoothly.

Question content

I compiled a Go test library by running go test -c ./model. According to the Go documentation, it can be run using the go run -exec xprog command, however, I keep getting errors when trying to run the generated model.test binary. What is the complete command here?

P.S I know you can use different flags to compile and run, but that's not what I need.

Workaround

You can run this binary just like any other binary. For example, in the shell:

./model.test
Copy after login

The test results will be written to standard output, and if all tests pass, the process exit code will be 0.

The above is the detailed content of How to run compiled Go test binaries?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!