GO & intellijidea 2016: run GO project in intellij idea

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


GO & intellijidea 2016 run GOlang project in intellij idea


Solving:

1. Create Go lang project - detailed tutorial here:

create Golang project in idea


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


2. Let's create hello world code and Run it - delete all from file "HelloWorld.go" and put following code

GO & intellijidea 2016 run GOlang project in intellij idea - tutorial screenshot 1


package main

import "fmt"
func main() {
       fmt.Printf("Hello, world.\n")
}

GO & intellijidea 2016 run GOlang project in intellij idea - tutorial screenshot 2


3. Now we need to create "Run configuration" to build & run HelloWorld.go

In menu click "Run" -> "Run"

GO & intellijidea 2016 run GOlang project in intellij idea - tutorial screenshot 3

4. In "Run" dialog click "Edit configurations..."

GO & intellijidea 2016 run GOlang project in intellij idea - tutorial screenshot 4

5. Click "+" button to add new configuration

GO & intellijidea 2016 run GOlang project in intellij idea - tutorial screenshot 5

6. In "Add New Configuration" dialog - click "Go Application"

GO & intellijidea 2016 run GOlang project in intellij idea - tutorial screenshot 6


7.  Type run config name,
type file name in project folder with package "main" and fn "main" ( entry point ),
click "Apply" button,
click  "Run" button

GO & intellijidea 2016 run GOlang project in intellij idea - tutorial screenshot 7

8. Hooray :)

GO & intellijidea 2016 run GOlang project in intellij idea - tutorial screenshot 8


No comments:

Post a Comment