Understanding Go's net package-Day 2- I wrote
Among the Go packages, I will study the net
package, which is one of the packages that I am not good at.
The net package provides a portable interface to Unix network sockets, including TCP/IP, UDP, domain name resolution, and UNIX domain sockets.
Quote: http://golang.jp/pkg/net
main.go
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello World")
}
Now when you access port 8080, you should see Hello World
.
Once here,