This is a creation in Article, where the information may have evolved or changed.
For the Go Language development environment is recommended on the Internet is liteide of course, now the major mainstream IDE tools have plug-in support such as Eclipse,intellij.
So today we will talk about some of the pits Liteide met.
First we need to install go first, by default the go is installed automatically goroot (Windows).
Next Download Liteide http://www.golangtc.com/download/liteide
After the installation, we will carry out our Hello World
We can do it with decompression liteide (not very lightweight)
Here to focus on the environment settings
This environment setting mainly involves your build install and so on (settings including goroot,gopath,gobin), etc.
Here to focus on the relevant information
For Goroot: Equivalent to Javahome mainly includes Go's boot file, basic package (library) files, etc.
For Gopath: The environment variable equivalent to Javaclasspath is the Go User development package can be used; (:) split
For Gobin: The specified bin directory may not be set when the main go language is installed. This is set to the D:\go\bin equivalent to the generated EXE file to put here
Let's execute a Hello World example
First create a main file Portal main package:
Choose Command Project here (equivalent to the main entry of the project)
Build a dependent package at the same time
Choose Package Project Here
Set the Hello function in Hello
Hello project hello.go
Package Hello
Import"FMT"
FuncHello (whostring){
FMT. Printf ("Hello,%s!\n",who)
}
Reference the Hello package in the main package and use the Hello function
test Project Main.go
Package Main
Import(
"Hello"
)
FuncMain (){
Hello. Hello ("go!")
}
Execute BR to build
Execution results
C:/go/bin/go.exe build-i [D:/go/src/test]
Success: Process exit code 0.
D:/go/src/test/test.exe [D:/go/src/test]
Hello, go!!.
Success: Process exit code 0.
Generate Test.exe files at the same time:
Execute the Install method (right click on the test directory):
Generate File:
Bin
Pkg