GO & intellijidea 2016: create GO project in intellij idea

Trabla: GO & intellijidea 2016: create and run GO project in intellij idea


GO & intellijidea 2016: create GO project in intellij idea

This tutorial explains how to create first GO lang project in Intellij IDEA 2016.1 an run it ( on windows OS).





Solving:

1. Install Go lang 1.6 for Windows


install Golang 1.6 on windows 7


https://codingtrabla.blogspot.com/2016/03/go-install-golang-on-windows.html

2. Install Go lang plugin for Intellij IDEA 2016.1,
detailed tutorial here:

install golang plugin in intellij idea


https://codingtrabla.blogspot.com/2016/03/intellijidea-20161-install-intellij.html



3.  Run intellij IDEA , click "Create New Project"

GO & intellijidea 2016: create GO project in intellij idea tutorial 1

4. In "New Project" dialog windows click on "Go"  and  press "Next" button

GO & intellijidea 2016: create GO project in intellij idea tutorial 2

5. Now we need to select Go SDK - press "Configure" button

GO & intellijidea 2016: create GO project in intellij idea tutorial  3

6. In dialog "Select Home Directory for Go SDK" select directory where Go is installed,
and press "OK" button.
E.g. on my PC - C:\Go

GO & intellijidea 2016: create GO project in intellij idea tutorial 4

7. If Go SDK is detected and all is ok - you will see it on screen - Go icon with version.
Press "Next" button.

GO & intellijidea 2016: create GO project in intellij idea tutorial 5

8. Type project name e.g. GoHelloWorldProject and press "Finish" button.

GO & intellijidea 2016: create GO project in intellij idea tutorial 6

9. Hooray, project created !!!  Create new .go file 
 right mouse click on project -> "New" -> "Go File"


GO & intellijidea 2016: create GO project in intellij idea tutorial 7


10. Type file name - "HelloWorld" and press "OK"

GO & intellijidea 2016: create GO project in intellij idea tutorial 8

11. Now we see error message "GOPATH is empty" - we need to set "GOPATH"

GO & intellijidea 2016: create GO project in intellij idea tutorial 9

12. Add GOPATH - same path as project source folder,
disable checkbox "Use GOPATHdefined in system environment"
and press "Ok" button.

GO & intellijidea 2016: create GO project in intellij idea tutorial 10

13. Now we need to put some code into HelloWorld.go
and setup Run configuration -

https://codingtrabla.blogspot.com/2016/03/go-intellijidea-2016-run-go-project-in.html


No comments:

Post a Comment