可以在 Windows 上安装 Go 编译器吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1717652/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can Go compiler be installed on Windows?
提问by user208987
I've been looking on golang.orgfor a Windows compiler, but I can't seem to find it. I can only see Linux and OS X compilers. Does anyone know if Go programming can be done on Windows, or is it something that Google hasn't implemented yet?
我一直在golang.org上寻找Windows 编译器,但我似乎找不到它。我只能看到 Linux 和 OS X 编译器。有谁知道 Go 编程是否可以在 Windows 上完成,或者谷歌还没有实现?
Update: appears that as of now (Nov. 2012) golang.orghas official binary releases for windows 32/x86_64.
更新:截至目前(2012 年 11 月),golang.org似乎有适用于 Windows 32/x86_64 的官方二进制版本。
回答by Jonas
There are now installers for Windows, see Go under Windows
现在有适用于 Windows 的安装程序,请参阅Windows 下的 Go
HelloWorld.go
你好世界
package main
func main() {
println("Hello World!");
}
Compile with 8g
, link with 8l
and then execute. Example:
编译8g
,链接,8l
然后执行。例子:
8g HelloWorld.go
8l -o HelloWorld.exe HelloWorld.8
HelloWorld
回答by mbarnett
It hasn't made it onto the Go Lang FAQ yet, but from the changelog:
它尚未出现在 Go Lang FAQ 中,但来自更新日志:
Why doesn't Go run on Windows? We understand that a significant fraction of computers in the world run Windows and it would be great if those computers could run Go programs. However, the Go team is small and we don't have the resources to do a Windows port at the moment. We would be more than willing to answer questions and offer advice to anyone willing to develop a Windows version.
为什么 Go 不能在 Windows 上运行?我们知道世界上有很大一部分计算机运行 Windows,如果这些计算机可以运行 Go 程序就太好了。但是,Go 团队很小,我们目前没有资源来进行 Windows 移植。我们非常愿意回答问题并向愿意开发 Windows 版本的任何人提供建议。
回答by Colonel Panic
Yes!As of 2012 the Go homepage offers an official Windows installer (32 or 64 bit) https://golang.org/dl/
是的!截至 2012 年,Go 主页提供了官方 Windows 安装程序(32 位或 64 位)https://golang.org/dl/
回答by J?rg W Mittag
Despite the fact that Go is only two days old, this question has alreadybecome a FAQ on the Go mailinglist. (Unfortunately, it has not yet been added to the FAQ list on the website.)
尽管 Go 才诞生两天,但这个问题已经成为 Go 邮件列表上的常见问题解答。(遗憾的是,它还没有被添加到网站的常见问题列表中。)
Basically, Go is done by a very small group of people, so they simply do not have the time nor the resources to do a Windows port. That very small group of people also happens to be the people who invented Unix, so that was kind of a natural first target.
基本上,Go 是由一小群人完成的,所以他们根本没有时间和资源来做 Windows 移植。那一小群人也恰好是 Unix 的发明者,所以这自然是第一个目标。
回答by OscarRyz
Not yet.
还没有。
The authors of Go have very very deeply roots on non Windows operating systems ( Trivia: who of them created no less than the very UNIX operating system )
Go 的作者在非 Windows 操作系统上有着非常深的根基(花絮:他们中的人创造了不亚于 UNIX 操作系统)
So, don't expect to have a Windows port from them any time soon.
因此,不要指望很快就会从他们那里获得 Windows 端口。
The language is open source, so it will be just a matter of time ( make it from 6 - 8 ehrm months ) for a Windows implementation will be available.
该语言是开源的,因此 Windows 实现将可用只是时间问题(从 6 到 8 ehrm 个月)。
回答by Rob Russell
So if you, like me, are on Windows a lot of the time and want to do some Go programming right now, you can do it on a VM. I use VirtualBox running Ubuntu in seemless mode. I already had it set up because I like Linux better than Windows for a lot of things.
因此,如果您像我一样经常使用 Windows 并且现在想进行一些 Go 编程,那么您可以在 VM 上进行。我使用 VirtualBox 以无缝模式运行 Ubuntu。我已经设置好了,因为在很多方面我更喜欢 Linux 而不是 Windows。
Building and working with Go has been totally painless for me. I have a Bash open in a terminal to run my build and try my app. The source directory is a shared folder between Windows and Linux (a VirtualBox feature but I'm sure VMWare has the same thing). I edit my code in Komodo Edit on Windows and use Mercurial for the same source code on both OSes.
构建和使用 Go 对我来说完全没有痛苦。我在终端中打开了一个 Bash 来运行我的构建并尝试我的应用程序。源目录是 Windows 和 Linux 之间的共享文件夹(VirtualBox 功能,但我确定 VMWare 具有相同的功能)。我在 Windows 上的 Komodo Edit 中编辑我的代码,并在两个操作系统上对相同的源代码使用 Mercurial。
回答by Frank
回答by uriel
Various efforts to port Go to windows are underway.
将 Go 移植到 windows 的各种努力正在进行中。
The most advance and that can already build and run some code is here: http://code.google.com/r/hectorchu-go-windows/
最先进的并且已经可以构建和运行一些代码的在这里:http: //code.google.com/r/hectorchu-go-windows/
回答by sudhakar
Installation of Go on windows is straight forward if you use the experimental x32 windows port. Documentation of the steps for Go installation on windowscan found here
如果您使用实验性的 x32 windows 端口,则在 windows 上安装 Go 很简单 。在 Windows 上安装 Go的步骤文档可以在这里找到
You will probably also want the MinGW tools (bash, make, gcc, etc...): http://sourceforge.net/projects/mingw/files/
您可能还需要 MinGW 工具(bash、make、gcc 等...):http: //sourceforge.net/projects/mingw/files/
and the GTK+ files and tools (the "all-in-one bundle" includes pkg-config): http://www.gtk.org/download/win32.php
以及 GTK+ 文件和工具(“多合一包”包括 pkg-config):http: //www.gtk.org/download/win32.php