Go

Install

$ wget https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz  
$ sudo tar -C /usr/local -xzf go1.6.2.linux-amd64.tar.gz  

환경설정

.bash_profile

export PATH=/usr/local/go/bin:$PATH
$ go env 
$ go version 

GOROOT 설정

export GOROOT=$HOME/go 

Tip: 설치 경로가 /usr/local/go 또는 C:\Go 라면 GOROOT를 설정할 필요가 없다.

GOPATH 설정

export GOPATH=$HOME/go/work 

명령 도구 설치

$ sudo go get golang.org/x/tools/cmd/...

실행 파일 경로 설정

export PATH=$GOPATH/bin:$PATH

Hello

package main

import "fmt"

func main() {
	fmt.Printf("hello, world\n")
}
$ gofmt -w hello.go
$ goimports -w hello.go
$ gorun hello.go
$ go install hello
$ hello
hello, world
$ go get github.com/yeopoong/go/hanoi
$ go build github.com/yeopoong/go/hanoi
$ hanoi
$ taskman --addr=localhost:8000 --root=c:\dev\go\src\github.com\jaeyeom/gogo/net/http/taskman

Reference

Getting Started 디스커버리 Go




© 2017. by yeopoong.github.io

Powered by yeopoong