package main
import ( “log” “net/http” “os” )
func first(w http.ResponseWriter, r http.Request) { f, err := os.Open(“/Users/mazhilei/Desktop/subject/Golang-test/web/daty01/main.go”) if err ! = nil {log.print (err)} // defer f.close () // io.copy (w, f)// return request // read all //buf, Buf := make([]byte, 10242) ln, _ := f.read (buf) w.write (buf[:ln])
} func main() { http.HandleFunc(“/”, first) http.ListenAndServe(“:8080”, nil)
}