diff --git a/000_temp/44_class/03_uuid/main.go b/000_temp/44_class/03_uuid/main.go index 73380fcc..b009522c 100644 --- a/000_temp/44_class/03_uuid/main.go +++ b/000_temp/44_class/03_uuid/main.go @@ -15,7 +15,7 @@ func main() { func foo(w http.ResponseWriter, req *http.Request) { c, err := req.Cookie("session") if err != nil { - sID := uuid.NewV4() + sID, _ := uuid.NewV4() c = &http.Cookie{ Name: "session", Value: sID.String(), diff --git a/000_temp/44_class/04_session/main.go b/000_temp/44_class/04_session/main.go index 121b4fc2..089b10de 100644 --- a/000_temp/44_class/04_session/main.go +++ b/000_temp/44_class/04_session/main.go @@ -29,7 +29,7 @@ func foo(w http.ResponseWriter, req *http.Request) { // get cookie c, err := req.Cookie("session") if err != nil { - sID := uuid.NewV4() + sID, _ := uuid.NewV4() c = &http.Cookie{ Name: "session", Value: sID.String(), diff --git a/000_temp/44_class/07_hands-on_login/starting-code/main.go b/000_temp/44_class/07_hands-on_login/starting-code/main.go index c1d54275..3840d71f 100644 --- a/000_temp/44_class/07_hands-on_login/starting-code/main.go +++ b/000_temp/44_class/07_hands-on_login/starting-code/main.go @@ -35,7 +35,7 @@ func index(w http.ResponseWriter, req *http.Request) { // get cookie c, err := req.Cookie("session") if err != nil { - sID := uuid.NewV4() + sID, _ := uuid.NewV4() c = &http.Cookie{ Name: "session", Value: sID.String(), @@ -97,7 +97,7 @@ func login(w http.ResponseWriter, req *http.Request) { return } // create a session - sID := uuid.NewV4() + sID, _ := uuid.NewV4() c := &http.Cookie{ Name: "session", Value: sID.String(), diff --git a/000_temp/52-race-condition/06_chan-pre-lecture/main.go b/000_temp/52-race-condition/06_chan-pre-lecture/main.go index 193836bb..e3083e04 100644 --- a/000_temp/52-race-condition/06_chan-pre-lecture/main.go +++ b/000_temp/52-race-condition/06_chan-pre-lecture/main.go @@ -30,4 +30,4 @@ func main() { wg.Wait() close(c) fmt.Println("total count:", counter) -} \ No newline at end of file +} diff --git a/000_temp/55-website/main.go b/000_temp/55-website/main.go index 951d0842..51e61ade 100644 --- a/000_temp/55-website/main.go +++ b/000_temp/55-website/main.go @@ -1,8 +1,8 @@ package main import ( - "net/http" "html/template" + "net/http" ) var tpl *template.Template @@ -14,4 +14,4 @@ func init() { func main() { loadRoutes() http.ListenAndServe(":8080", nil) -} \ No newline at end of file +} diff --git a/000_temp/55-website/rAbout.go b/000_temp/55-website/rAbout.go index 19a7e6aa..12e1a845 100644 --- a/000_temp/55-website/rAbout.go +++ b/000_temp/55-website/rAbout.go @@ -1,8 +1,8 @@ package main import ( - "net/http" "log" + "net/http" ) func about(w http.ResponseWriter, r *http.Request) { @@ -11,4 +11,3 @@ func about(w http.ResponseWriter, r *http.Request) { log.Println(err) } } - diff --git a/000_temp/55-website/rIndex.go b/000_temp/55-website/rIndex.go index d9c23ef9..fbf9401c 100644 --- a/000_temp/55-website/rIndex.go +++ b/000_temp/55-website/rIndex.go @@ -1,8 +1,8 @@ package main import ( - "net/http" "log" + "net/http" ) func index(w http.ResponseWriter, r *http.Request) { diff --git a/000_temp/56_SVCC-17/01a/main.go b/000_temp/56_SVCC-17/01a/main.go index edbeae10..4900f12c 100644 --- a/000_temp/56_SVCC-17/01a/main.go +++ b/000_temp/56_SVCC-17/01a/main.go @@ -1,8 +1,8 @@ package main import ( - "net/http" "io" + "net/http" ) func main() { diff --git a/000_temp/56_SVCC-17/01b/main.go b/000_temp/56_SVCC-17/01b/main.go index 1493ee89..279761d5 100644 --- a/000_temp/56_SVCC-17/01b/main.go +++ b/000_temp/56_SVCC-17/01b/main.go @@ -1,8 +1,8 @@ package main import ( - "net/http" "io" + "net/http" ) func main() { @@ -12,4 +12,4 @@ func main() { func foo(w http.ResponseWriter, r *http.Request) { io.WriteString(w, "hello world") -} \ No newline at end of file +} diff --git a/000_temp/56_SVCC-17/01c/main.go b/000_temp/56_SVCC-17/01c/main.go index 876bf60b..c48636a0 100644 --- a/000_temp/56_SVCC-17/01c/main.go +++ b/000_temp/56_SVCC-17/01c/main.go @@ -1,8 +1,8 @@ package main import ( - "net/http" "io" + "net/http" ) func main() { @@ -10,6 +10,6 @@ func main() { http.ListenAndServe(":8080", nil) } -func index(w http.ResponseWriter, r *http.Request){ +func index(w http.ResponseWriter, r *http.Request) { io.WriteString(w, "Hello SVCC from Paypal") } diff --git a/000_temp/56_SVCC-17/01d/main.go b/000_temp/56_SVCC-17/01d/main.go new file mode 100644 index 00000000..68f251c9 --- /dev/null +++ b/000_temp/56_SVCC-17/01d/main.go @@ -0,0 +1,15 @@ +package main + +import ( + "io" + "net/http" +) + +func main() { + http.HandleFunc("/", index) + http.ListenAndServe(":8080", nil) +} + +func index(w http.ResponseWriter, r *http.Request) { + io.WriteString(w, "Hello GDG Fresno") +} diff --git a/000_temp/56_SVCC-17/02a/main.go b/000_temp/56_SVCC-17/02a/main.go index f7e8ea89..ffcebebe 100644 --- a/000_temp/56_SVCC-17/02a/main.go +++ b/000_temp/56_SVCC-17/02a/main.go @@ -1,8 +1,8 @@ package main import ( - "net/http" "html/template" + "net/http" ) var tpl *template.Template @@ -18,4 +18,4 @@ func main() { func foo(w http.ResponseWriter, r *http.Request) { tpl.ExecuteTemplate(w, "index.gohtml", nil) -} \ No newline at end of file +} diff --git a/000_temp/56_SVCC-17/02b/main.go b/000_temp/56_SVCC-17/02b/main.go index f7e8ea89..ffcebebe 100644 --- a/000_temp/56_SVCC-17/02b/main.go +++ b/000_temp/56_SVCC-17/02b/main.go @@ -1,8 +1,8 @@ package main import ( - "net/http" "html/template" + "net/http" ) var tpl *template.Template @@ -18,4 +18,4 @@ func main() { func foo(w http.ResponseWriter, r *http.Request) { tpl.ExecuteTemplate(w, "index.gohtml", nil) -} \ No newline at end of file +} diff --git a/000_temp/56_SVCC-17/02c/main.go b/000_temp/56_SVCC-17/02c/main.go index 15895c70..3c978b33 100644 --- a/000_temp/56_SVCC-17/02c/main.go +++ b/000_temp/56_SVCC-17/02c/main.go @@ -1,8 +1,8 @@ package main import ( - "net/http" "html/template" + "net/http" ) var tpl *template.Template @@ -16,6 +16,6 @@ func main() { http.ListenAndServe(":8080", nil) } -func index(w http.ResponseWriter, r *http.Request){ +func index(w http.ResponseWriter, r *http.Request) { tpl.ExecuteTemplate(w, "index.gohtml", nil) } diff --git a/000_temp/56_SVCC-17/02d/main.go b/000_temp/56_SVCC-17/02d/main.go new file mode 100644 index 00000000..21ff5e92 --- /dev/null +++ b/000_temp/56_SVCC-17/02d/main.go @@ -0,0 +1,21 @@ +package main + +import ( + "html/template" + "net/http" +) + +var tpl *template.Template + +func init() { + tpl = template.Must(template.ParseGlob("templates/*.gohtml")) +} + +func main() { + http.HandleFunc("/", index) + http.ListenAndServe(":8080", nil) +} + +func index(w http.ResponseWriter, r *http.Request) { + tpl.ExecuteTemplate(w, "index.gohtml", nil) +} diff --git a/000_temp/56_SVCC-17/02d/templates/index.gohtml b/000_temp/56_SVCC-17/02d/templates/index.gohtml new file mode 100644 index 00000000..8e1962ae --- /dev/null +++ b/000_temp/56_SVCC-17/02d/templates/index.gohtml @@ -0,0 +1,15 @@ + + +
+ + + +