Skip to content

Commit 17e3852

Browse files
committed
you're doing great
1 parent 13719da commit 17e3852

File tree

127 files changed

+330
-345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+330
-345
lines changed

Diff for: 000_temp/44_class/11_hello-world/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"net/http"
54
"io"
5+
"net/http"
66
)
77

88
func main() {
@@ -12,4 +12,4 @@ func main() {
1212

1313
func index(w http.ResponseWriter, r *http.Request) {
1414
io.WriteString(w, "Hello world")
15-
}
15+
}

Diff for: 000_temp/44_class/13_interface/cache/main.go

-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ type Cache interface {
44
Set(k string, val interface{})
55
Get(k string) interface{}
66
}
7-

Diff for: 000_temp/44_class/13_interface/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"github.com/GoesToEleven/golang-web-dev/000_temp/44_class/13_interface/memcache"
54
"github.com/GoesToEleven/golang-web-dev/000_temp/44_class/13_interface/cmd"
5+
"github.com/GoesToEleven/golang-web-dev/000_temp/44_class/13_interface/memcache"
66
)
77

88
func main() {

Diff for: 000_temp/44_class/14_data-structure/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
type person struct {
88
first string
9-
last string
9+
last string
1010
}
1111

1212
type secretAgent struct {
@@ -47,4 +47,4 @@ func main() {
4747
}
4848
sa1.greeting()
4949
sayMore(sa1)
50-
}
50+
}

Diff for: 000_temp/44_class/15/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package main
22

33
import (
4-
"net/http"
5-
"io"
64
"fmt"
5+
"io"
6+
"net/http"
77
)
88

99
func init() {
@@ -18,4 +18,4 @@ func main() {
1818

1919
func index(w http.ResponseWriter, r *http.Request) {
2020
io.WriteString(w, "Hello world")
21-
}
21+
}

Diff for: 000_temp/45_pagination/main.go

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
package main
22

33
import (
4+
"fmt"
45
"html/template"
56
"net/http"
6-
"fmt"
77
"strconv"
88
)
99

1010
type Env struct {
11-
Data []int
12-
From int
13-
To int
14-
Amount int
15-
ForwardStart int
11+
Data []int
12+
From int
13+
To int
14+
Amount int
15+
ForwardStart int
1616
BackwardStart int
1717
}
1818

1919
var tpl *template.Template
2020
var xi []int
2121

22-
2322
func init() {
2423
tpl = template.Must(template.ParseGlob("templates/*.gohtml"))
2524
}
@@ -62,7 +61,7 @@ func index(w http.ResponseWriter, r *http.Request) {
6261
// then the next group of records would start at "to"
6362
// but only if there are such records
6463
var fs int
65-
if to + recordsPerPageToShow <= len(xi) {
64+
if to+recordsPerPageToShow <= len(xi) {
6665
fs = to
6766
} else {
6867
fs = len(xi) - recordsPerPageToShow
@@ -73,22 +72,22 @@ func index(w http.ResponseWriter, r *http.Request) {
7372
// then the previous group of records would start at "from" minus ten (records shown)
7473
// but only if there are such records
7574
var bs int
76-
if from - recordsPerPageToShow >= 0 {
75+
if from-recordsPerPageToShow >= 0 {
7776
bs = from - recordsPerPageToShow
7877
} else {
7978
bs = 0
8079
}
8180

8281
data := Env{
83-
Data: xx,
84-
From: from,
85-
To: to - 1,
86-
Amount: recordsPerPageToShow,
87-
ForwardStart: fs,
82+
Data: xx,
83+
From: from,
84+
To: to - 1,
85+
Amount: recordsPerPageToShow,
86+
ForwardStart: fs,
8887
BackwardStart: bs,
8988
}
9089
err = tpl.ExecuteTemplate(w, "index.gohtml", data)
9190
if err != nil {
9291
fmt.Println(err)
9392
}
94-
}
93+
}

Diff for: 000_temp/46_sp17/01/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"net/http"
54
"io"
5+
"net/http"
66
)
77

88
func main() {

Diff for: 000_temp/46_sp17/02/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ func main() {
1010

1111
func foo() {
1212
fmt.Println("hello")
13-
}
13+
}

Diff for: 000_temp/46_sp17/03_handle_handler_handlefunc/01_handle/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package main
22

33
import (
4-
"net/http"
54
"io"
5+
"net/http"
66
)
77

88
type hotdog int
99

10-
func(hotdog) ServeHTTP(w http.ResponseWriter, r *http.Request) {
10+
func (hotdog) ServeHTTP(w http.ResponseWriter, r *http.Request) {
1111
io.WriteString(w, "Hello from hotdogger")
1212
}
1313

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"net/http"
54
"io"
5+
"net/http"
66
)
77

88
func main() {
@@ -12,4 +12,4 @@ func main() {
1212

1313
func foo(w http.ResponseWriter, r *http.Request) {
1414
io.WriteString(w, "Hello from hotdiggity dogger")
15-
}
15+
}

Diff for: 000_temp/46_sp17/03_handle_handler_handlefunc/03_handlerfunc/main.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"net/http"
54
"io"
5+
"net/http"
66
)
77

88
func main() {
@@ -13,4 +13,3 @@ func main() {
1313
func foo(w http.ResponseWriter, r *http.Request) {
1414
io.WriteString(w, "Holy diggity dogger")
1515
}
16-

Diff for: 000_temp/46_sp17/04/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ package main
33
import "fmt"
44

55
func main() {
6-
m := map[string]int{"Bond":32, "Moneypenny": 24}
6+
m := map[string]int{"Bond": 32, "Moneypenny": 24}
77
fmt.Println(m)
8-
}
8+
}

Diff for: 000_temp/46_sp17/05/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ func main() {
1010

1111
func foo(x int) {
1212
fmt.Println("hello", x)
13-
}
13+
}

Diff for: 000_temp/46_sp17/06/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ func main() {
1111
}
1212

1313
func foo() {
14-
fmt.Println(z,z,z,z,z)
15-
}
14+
fmt.Println(z, z, z, z, z)
15+
}

Diff for: 000_temp/46_sp17/07_bond/main.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ func foo(h human) {
2929
fmt.Println("hello from foo")
3030
}
3131

32-
3332
func main() {
3433
p1 := person{"Nina", "Simone", 25}
3534
sa1 := secretAgent{person{"Ian", "Fleming", 42}, false}
3635
foo(p1)
3736
foo(sa1)
38-
}
37+
}

Diff for: 000_temp/46_sp17/08_notfound-notfoundhandler/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ func main() {
1010

1111
func index(w http.ResponseWriter, r *http.Request) {
1212
http.NotFound(w, r)
13-
}
13+
}

Diff for: 000_temp/46_sp17/09_fundamentals/01/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ func main() {
1515
p2 := person{"Bond"}
1616
p1.speak()
1717
p2.speak()
18-
}
18+
}

Diff for: 000_temp/46_sp17/09_fundamentals/02/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ package main
33
import "fmt"
44

55
func main() {
6-
xi := []int{4,3,5,7,3,4,5}
6+
xi := []int{4, 3, 5, 7, 3, 4, 5}
77
fmt.Println(xi)
88

99
for i, v := range xi {
1010
fmt.Println(i, v)
1111
}
1212

13-
m := map[string]int{"mcleod":42, "bond":32}
13+
m := map[string]int{"mcleod": 42, "bond": 32}
1414
fmt.Println(m)
1515

1616
for k, v := range m {
1717
fmt.Println(k, v)
1818
}
19-
}
19+
}

Diff for: 000_temp/46_sp17/09_fundamentals/03/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import "fmt"
44

5-
type human interface{
5+
type human interface {
66
speak()
77
}
88

@@ -33,4 +33,4 @@ func main() {
3333
foo(p1)
3434
foo(p2)
3535
foo(c1)
36-
}
36+
}

Diff for: 000_temp/46_sp17/11/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"net/http"
54
"fmt"
5+
"net/http"
66
)
77

88
func main() {

Diff for: 000_temp/46_sp17/12/main.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"net/http"
54
"fmt"
5+
"net/http"
66
)
77

88
func main() {
@@ -34,7 +34,6 @@ Hello from index
3434
</html>`)
3535
}
3636

37-
3837
func about(w http.ResponseWriter, r *http.Request) {
3938
fmt.Fprint(w, `<!DOCTYPE html>
4039
<html lang="en">
@@ -57,7 +56,6 @@ Hello from about
5756
</html>`)
5857
}
5958

60-
6159
func contact(w http.ResponseWriter, r *http.Request) {
6260
fmt.Fprint(w, `<!DOCTYPE html>
6361
<html lang="en">

Diff for: 000_temp/46_sp17/13/main.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"net/http"
54
"html/template"
5+
"net/http"
66
)
77

88
var tpl *template.Template
@@ -22,12 +22,10 @@ func index(w http.ResponseWriter, r *http.Request) {
2222
tpl.ExecuteTemplate(w, "index.gohtml", nil)
2323
}
2424

25-
2625
func about(w http.ResponseWriter, r *http.Request) {
2726
tpl.ExecuteTemplate(w, "about.gohtml", nil)
2827
}
2928

30-
3129
func contact(w http.ResponseWriter, r *http.Request) {
3230
tpl.ExecuteTemplate(w, "contact.gohtml", nil)
3331
}

Diff for: 000_temp/46_sp17/14/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"net/http"
54
"html/template"
5+
"net/http"
66
)
77

88
var tpl *template.Template
@@ -18,4 +18,4 @@ func main() {
1818

1919
func index(w http.ResponseWriter, r *http.Request) {
2020
tpl.ExecuteTemplate(w, "index.gohtml", nil)
21-
}
21+
}

Diff for: 000_temp/46_sp17/15/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"net/http"
54
"html/template"
5+
"net/http"
66
)
77

88
var tpl *template.Template
@@ -18,4 +18,4 @@ func main() {
1818

1919
func index(w http.ResponseWriter, r *http.Request) {
2020
tpl.ExecuteTemplate(w, "index.gohtml", 42)
21-
}
21+
}

0 commit comments

Comments
 (0)