diff --git a/2022/01/golang_demo2/.gitignore b/2022/01/golang_demo2/.gitignore new file mode 100644 index 0000000..29b636a --- /dev/null +++ b/2022/01/golang_demo2/.gitignore @@ -0,0 +1,2 @@ +.idea +*.iml \ No newline at end of file diff --git a/2022/01/golang_demo2/Program.go b/2022/01/golang_demo2/Program.go index 9e2f6bd..b2ec0ec 100644 --- a/2022/01/golang_demo2/Program.go +++ b/2022/01/golang_demo2/Program.go @@ -26,6 +26,7 @@ func handleIndex(writer http.ResponseWriter, _ *http.Request) { writer.WriteHeader(500) _, _ = writer.Write([]byte("Internal server error")) _, _ = fmt.Fprintf(os.Stderr, "Internal server error while marshalling response") + return } writer.Header().Set("Content-Type", "application/json") @@ -51,6 +52,7 @@ func handleInfo(writer http.ResponseWriter, _ *http.Request) { writer.WriteHeader(500) _, _ = writer.Write([]byte("Internal server error")) _, _ = fmt.Fprintf(os.Stderr, "Internal server error while marshalling response") + return } writer.Header().Set("Content-Type", "application/json") @@ -77,6 +79,7 @@ func handleDefault(writer http.ResponseWriter, _ *http.Request) { writer.WriteHeader(500) _, _ = writer.Write([]byte("Internal server error")) _, _ = fmt.Fprintf(os.Stderr, "Internal server error while marshalling response") + return } writer.Header().Set("Content-Type", "application/json")