From ac1b579acc6b2eea5c9d22f9600721e0d10a98b5 Mon Sep 17 00:00:00 2001 From: Akash Godre <64258997+akashgodre28@users.noreply.github.com> Date: Sun, 22 Jan 2023 23:07:25 +0530 Subject: [PATCH 1/3] Update main.go Fixed: Response Header --- 24buildapi/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/24buildapi/main.go b/24buildapi/main.go index 8853786..d392c08 100644 --- a/24buildapi/main.go +++ b/24buildapi/main.go @@ -64,13 +64,13 @@ func serveHome(w http.ResponseWriter, r *http.Request) { func getAllCourses(w http.ResponseWriter, r *http.Request) { fmt.Println("Get all courses") - w.Header().Set("Content-Type", "applicatioan/json") + w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(courses) } func getOneCourse(w http.ResponseWriter, r *http.Request) { fmt.Println("Get one course") - w.Header().Set("Content-Type", "applicatioan/json") + w.Header().Set("Content-Type", "application/json") // grab id from request params := mux.Vars(r) @@ -88,7 +88,7 @@ func getOneCourse(w http.ResponseWriter, r *http.Request) { func createOneCourse(w http.ResponseWriter, r *http.Request) { fmt.Println("Create one course") - w.Header().Set("Content-Type", "applicatioan/json") + w.Header().Set("Content-Type", "application/json") // what if: body is empty if r.Body == nil { @@ -120,7 +120,7 @@ func createOneCourse(w http.ResponseWriter, r *http.Request) { func updateOneCourse(w http.ResponseWriter, r *http.Request) { fmt.Println("Update one course") - w.Header().Set("Content-Type", "applicatioan/json") + w.Header().Set("Content-Type", "application/json") // first - grab id from req params := mux.Vars(r) @@ -143,7 +143,7 @@ func updateOneCourse(w http.ResponseWriter, r *http.Request) { func deleteOneCourse(w http.ResponseWriter, r *http.Request) { fmt.Println("Delete one course") - w.Header().Set("Content-Type", "applicatioan/json") + w.Header().Set("Content-Type", "application/json") params := mux.Vars(r) From 4e2cecba3f6169e88a3b7488bb8f3b52c41e62a8 Mon Sep 17 00:00:00 2001 From: Akash Godre <64258997+akashgodre28@users.noreply.github.com> Date: Mon, 23 Jan 2023 15:56:21 +0530 Subject: [PATCH 2/3] Update main.go --- 27mutexAndAwaitGroups/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/27mutexAndAwaitGroups/main.go b/27mutexAndAwaitGroups/main.go index e0217ea..73c89b0 100644 --- a/27mutexAndAwaitGroups/main.go +++ b/27mutexAndAwaitGroups/main.go @@ -13,7 +13,7 @@ func main() { var score = []int{0} - wg.Add(3) + wg.Add(4) go func(wg *sync.WaitGroup, m *sync.RWMutex) { fmt.Println("One R") mut.Lock() @@ -37,7 +37,7 @@ func main() { wg.Done() }(wg, mut) go func(wg *sync.WaitGroup, m *sync.RWMutex) { - fmt.Println("Three R") + fmt.Println("Reading Scores") mut.RLock() fmt.Println(score) mut.RUnlock() From 5c439f1ad00bb301e1b71e51ddb9001a7f2e4ec5 Mon Sep 17 00:00:00 2001 From: Akash Godre <64258997+akashgodre28@users.noreply.github.com> Date: Mon, 23 Jan 2023 16:12:15 +0530 Subject: [PATCH 3/3] Update main.go --- 28channels/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/28channels/main.go b/28channels/main.go index efcb554..afc61be 100644 --- a/28channels/main.go +++ b/28channels/main.go @@ -17,20 +17,20 @@ func main() { // R ONLY go func(ch <-chan int, wg *sync.WaitGroup) { - val, isChanelOpen := <-myCh + val, isChanelOpen := <-ch fmt.Println(isChanelOpen) fmt.Println(val) - //fmt.Println(<-myCh) + //fmt.Println(<-ch) wg.Done() }(myCh, wg) // send ONLY go func(ch chan<- int, wg *sync.WaitGroup) { - myCh <- 0 - close(myCh) - // myCh <- 6 + ch <- 0 + close(ch) + // ch <- 6 wg.Done() }(myCh, wg)