可以在 Windows 上安装 Go 编译器吗?

我一直在寻找一个 Windows 编译器的 Golang.org,但我似乎找不到它。我只能看到 Linux 和 OS X 编译器。有人知道 Go 编程是否可以在 Windows 上完成,还是 Google 还没有实现?

更新: 从现在(2012年11月)起,Golang.org已经为 windows 32/x86 _ 64发布了正式的二进制版本。

34863 次浏览

It hasn't made it onto the Go Lang FAQ yet, but from the changelog:

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.

Despite the fact that Go is only two days old, this question has already become a FAQ on the Go mailinglist. (Unfortunately, it has not yet been added to the FAQ list on the website.)

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.

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 )

So, don't expect to have a Windows port from them any time soon.

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.

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.

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.

Although there is no Windows version at the moment, it can presumably be compiled using Cygwin on a Windows platform.

Various efforts to port Go to windows are underway.

The most advance and that can already build and run some code is here: http://code.google.com/r/hectorchu-go-windows/

There are now installers for Windows, see Go under Windows

HelloWorld.go

package main


func main() {
println("Hello World!");
}

Compile with 8g, link with 8l and then execute. Example:

8g HelloWorld.go
8l -o HelloWorld.exe HelloWorld.8
HelloWorld

Installation of Go on windows is straight forward if you use the experimental x32 windows port . Documentation of the steps for Go installation on windows can found here

You will probably also want the MinGW tools (bash, make, gcc, etc...): 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

Yes! As of 2012 the Go homepage offers an official Windows installer (32 or 64 bit) https://golang.org/dl/