如何编译Go语言程序

huangapple go评论67阅读模式
英文:

How to compile a program in Go

问题

我知道如何使用go run file.go来运行Go文件,但我想将其编译为可执行文件。
当我查找时,我发现了6g6l,但它们似乎已经过时了。

我想要的是:

go-compiler -o output file.go
英文:

I know how to run a file in go using go run file.go, but I want to compile it to an executable.
When I looked up, I found about 6g and 6l and it seems like they are outdated.

I want something like:

go-compiler -o output file.go

答案1

得分: 2

你想要的是:

go build -o 可执行文件名 源代码.go
英文:

You want:

go build -o executable source.go

huangapple
  • 本文由 发表于 2015年4月6日 17:48:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/29468840.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定