This is a creation in Article, where the information may have evolved or changed.
1. Download Address
Wind. Fox
Intellij idea Download (community version is available) https://www.jetbrains.com/idea/download/
Go language Download https://golang.org/dl/
Install http://blog.csdn.net/fenglailea/article/details/26163927 under LINUX
2. Installation
2.1 Intellij Idea installation slightly
2.2 Go Programming Language Installation
Choose Apple OS X here
Go1.7.3.darwin-amd64.pkg (78MB)
Download and install
3. Install the Go language plugin
Intellij idea Menu-"preferences-" Plugins tab
Remember to restart IntelliJ idea
4. Setting Environment variables
Current user
cd ~vim ~/.bash_profile
After opening the file, add the following to the last line:
export GOROOT=/usr/local/goexport GOBIN=$GOROOT/binexport GOARCH=amd64export GOOS=darwinexport GOPATH=/Users/fox/work/go-test1:/Users/fox/work/go-test2
Note that GOPATH the project directory is set according to your own project settings
If there are multiple directories, split with colons
Compile in effect
source ~/.bash_profile
See if it takes effect
echo$GOPATH
If the output information is the same as the one you set, then the configuration is in effect
After the success, here also:
Restart IntelliJ idea
5. New Project
New 3 directories, and 1 examples
binpkgsrcsrc/example/main.go
SRC directory to store Go source code (project source exists in this directory)
PKG Catalog Package Object
Bin directory holds executable objects
Main.go Source:
package mainimport ( "fmt")func main() { fmt.Println("Hello World!")}
6. Setting up the SDK
menu, File Project Structure
Select the Go Language installation directory
7. Third-party libraries
Execute in the Go project directory:
get gopkg.in/mgo.v2
gopkg.in/mgo.v2is a third-party library
Download speed depends on your speed, if the download is unsuccessful, re-execute the command can be
8. Full configuration effect is as follows
Compiling and running the program
Console print output
9.go Language View Variables
env