From c76d883ddaed6fbbc4b7f10f0494c9f0796d3c6d Mon Sep 17 00:00:00 2001 From: gleaming9 Date: Wed, 13 Nov 2024 16:14:17 +0900 Subject: [PATCH] update section54, 55 --- .idea/vcs.xml | 6 ++++++ _chapter14/section54/main.go | 20 ++++++++++++++++++++ _chapter14/section55/main.go | 5 +++++ _chapter14/section55/main_test.go | 7 +++++++ main.go | 1 - 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .idea/vcs.xml create mode 100644 _chapter14/section54/main.go create mode 100644 _chapter14/section55/main.go create mode 100644 _chapter14/section55/main_test.go delete mode 100644 main.go diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..9661ac7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/_chapter14/section54/main.go b/_chapter14/section54/main.go new file mode 100644 index 0000000..a16836e --- /dev/null +++ b/_chapter14/section54/main.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + "net/http" + "os" +) + +func main() { + err := http.ListenAndServe( + ":18080", + http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "Hello, %s!", r.URL.Path[1:]) + }), + ) + if err != nil { + fmt.Printf("failed to terminate server: %v", err) + os.Exit(1) + } +} diff --git a/_chapter14/section55/main.go b/_chapter14/section55/main.go new file mode 100644 index 0000000..feaf707 --- /dev/null +++ b/_chapter14/section55/main.go @@ -0,0 +1,5 @@ +package section55 + +func main() { + +} diff --git a/_chapter14/section55/main_test.go b/_chapter14/section55/main_test.go new file mode 100644 index 0000000..b3ff68c --- /dev/null +++ b/_chapter14/section55/main_test.go @@ -0,0 +1,7 @@ +package section55 + +import "testing" + +func TestMain(m *testing.M) { + go main() +} diff --git a/main.go b/main.go deleted file mode 100644 index 46635bb..0000000 --- a/main.go +++ /dev/null @@ -1 +0,0 @@ -package go_todo_app