Go - helloworld in eclipse


Introduction
When trying the first helloworld, I encountered some problem to setup environment. So note here.
You can find manual for complete information, here is just what I remember work for me.

Install Eclipse & Install Go
skip.. You can execute 
go version
to check is Go installed

Setup Env (Win10)
goroot
You don't need to set it, it was set to installed folder automatically in my machine
Set env: GOROOT={InstalledPath}

gopath
Set to a location for Go workspace
Set env: GOPATH={USERHOME}/Go
Remember to create this folder by yourself, otherwise eclipse may encounter problem

path
Add {Go installation}/bin
Check env

Eclipse
Download tools
Windows -> Preference -> Go -> Tools
Helloworld
Prepare script
This file need to be put under main folder, because it needs to be in main package
package main
import (
       "fmt"
)
func main() {
       fmt.Print("hello world")
}
File structure
Finally you can run the script to get helloworld print result


沒有留言:

張貼留言

caffeinate – make your Mac awake

When running long tests on macOS, the machine may go to sleep if you don’t touch it. There’s a built-in command that keeps it awake. ...