|
@@ -8,27 +8,25 @@ import (
|
|
|
|
|
|
func Index(w http.ResponseWriter, r *http.Request) {
|
|
func Index(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Println("Recv data")
|
|
fmt.Println("Recv data")
|
|
- /*
|
|
|
|
- fmt.Fprintf(w, "Hello world")
|
|
|
|
- fmt.Println("File opening...")
|
|
|
|
- file, err := os.Open("main.go")
|
|
|
|
- if err != nil {
|
|
|
|
- fmt.Println(err)
|
|
|
|
- os.Exit(1)
|
|
|
|
|
|
+ fmt.Fprintf(w, "Hello world")
|
|
|
|
+ fmt.Println("File opening...")
|
|
|
|
+ file, err := os.Open("main.go")
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ os.Exit(1)
|
|
|
|
+ }
|
|
|
|
+ defer file.Close()
|
|
|
|
+
|
|
|
|
+ data := make([]byte, 64)
|
|
|
|
+
|
|
|
|
+ for {
|
|
|
|
+ n, err := file.Read(data)
|
|
|
|
+ if err == io.EOF {
|
|
|
|
+ break
|
|
}
|
|
}
|
|
- defer file.Close()
|
|
|
|
-
|
|
|
|
- data := make([]byte, 64)
|
|
|
|
-
|
|
|
|
- for {
|
|
|
|
- n, err := file.Read(data)
|
|
|
|
- if err == io.EOF {
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- w.Write(data)
|
|
|
|
- fmt.Print(string(data[:n]))
|
|
|
|
- }
|
|
|
|
- */
|
|
|
|
|
|
+ w.Write(data)
|
|
|
|
+ fmt.Print(string(data[:n]))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
func Update(w http.ResponseWriter, r *http.Request) {
|
|
func Update(w http.ResponseWriter, r *http.Request) {
|