This is a creation in Article, where the information may have evolved or changed.
Last night and this morning on the Windows7, Ubuntu 12.04LTS and Mac OS X to try to configure the next Go Language development environment, install the go language is not a problem, is the use of Eclipse's Goclipse plugin to develop the go language, has not been run because the source file has not been compiled. Later to carefully read the next Goclipse document only to find that it is necessary to name the project directory cmd.
Here is a brief introduction to the use of goclipse to develop the note of the go language, as for the installation of the Go language and the configuration of the go language environment, there are too many tutorials on the network, this side will not repeat.
First, in Eclipse's install update, enter Goclipse's online update address: http://goclipse.googlecode.com/svn/trunk/goclipse-update-site/
After installing the Goclipse plug-in, configure the development parameters for the Go project in the Go under window, Preference. Goroot is the directory of the Go language installation on the computer, such as C:\Go (Windows) or/usr/local/go (Linux), Goarch is the model of the CPU, my 386;goos is the operating system, my windows Goroot is the location of the Go language bin file on the computer; Go path is the same as goroot. Among them, Goarch and goos These two goclipse should be will automatically help you match good. In addition, if you want to have the automatic code completion function, you can download Gocode and configure the Gocode address in the Gocode column.
The above is the configuration of the development parameters, next, we create a go Project.
In a Go project directory, there are three folders: Bin, pkg, SRC, where we only need to focus on the Bin folder and the Src folder. The bin folder is where the compiled source files are placed, that is, where the executable files are located, and SRC is the source file directory. Note that it is useless to create a file directly under SRC, because it will not compile, which is the biggest reason I have been unable to run successfully. We need to create a cmd folder under the SRC folder, then we can create a go file such as Go.go, then the package with main, we can type the following code:
Package Main
Import "FMT"
Func Main () {
Fmt. Printf ("Hello world!")
}
Then save, we can see an. exe file automatically appears under the Bin folder, which means that Goclipse is automatically compiled from the source file.
Then we run this project and we can see the word Hello world! on the console.
The go language is known as the C language of the cloud era, although the information is relatively small, but still is a desirable language, I hope you crossing in the go language to find programming enthusiasm and fun ~ ~ ~