haruprojectの日記(技術モノ)

日々の技術的な取り組みアウトプット用

2016-02-15から1日間の記事一覧

go言語でnet/httpでWEBサーバをたてる

続き。routetest.go package main import ( "fmt" "log" "net/http" ) func hello(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello World!") } func main() { http.HandleFunc("/", hello) err := http.ListenAndServe(":9090", nil) if e…

go言語でhello worldを"go fmt"してみる

続き。before hello.go package main import "fmt" func main() { fmt.Printf("hello, world\n") } hello.goがあるフォルダで。 $ go fmtafter hello.go package main import "fmt" func main() { fmt.Printf("hello, world\n") } コードが整形される。以上…

go言語インストールしてhello wordするとこまで

goのインストール Downloads - The Go Programming Language hello.go実行するとこまで $ export GOPATH=$HOME/work $ vi .profile $ export GOPATH=$HOME/work $ mkdir $HOME/work $ cd HOME/work vi hello.go package mainimport "fmt" // 入出力フォーマ…