`go build` 的输出标志 `o` 有副作用吗?
php小编新一在本文中将为大家解答一个关于 `go build` 命令的问题,即 `-o` 输出标志是否有副作用。在使用 `go build` 命令编译 Go 语言程序时,我们可以通过 `-o` 标志指定输出文件的名称。那么,这个标志会不会对源代码或其他文件产生任何副作用呢?接下来,我们将对这个问题进行详细的解析。
问题内容
来自 go build
的文档页面:
The -o flag forces build to write the resulting executable or object to the named output file or directory, instead of the default behavior described in the last two paragraphs. If the named output is an existing directory or ends with a slash or backslash, then any resulting executables will be written to that directory. 登录后复制