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) 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() 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)