Skip to content

Commit 06905f9

Browse files
committed
go fmt
1 parent f38f0b1 commit 06905f9

File tree

3 files changed

+31
-30
lines changed

3 files changed

+31
-30
lines changed

beginner/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func main() {
2727
company string = "Go Experts"
2828
salary float64 = 50000.0
2929
)
30-
30+
3131
fmt.Print(company)
3232
fmt.Print(salary)
3333
}

beginner/map01.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import "fmt"
44

55
func main() {
66

7-
m := make(map[string]int)
7+
m := make(map[string]int)
88

9-
m["a"] = 1
10-
m["b"] = 2
9+
m["a"] = 1
10+
m["b"] = 2
1111

12-
a := m["a"]
13-
fmt.Println("a: ", a)
12+
a := m["a"]
13+
fmt.Println("a: ", a)
1414

15-
delete(m, "b")
16-
b, ok := m["b"]
17-
fmt.Println("b: ", b)
18-
fmt.Println("ok? ", ok)
15+
delete(m, "b")
16+
b, ok := m["b"]
17+
fmt.Println("b: ", b)
18+
fmt.Println("ok? ", ok)
1919
}
Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
package main
22

33
import (
4-
"log"
5-
"net/http"
6-
"os"
4+
"fmt"
5+
"log"
6+
"net/http"
7+
"os"
78
)
89

910
func Log(handler http.Handler) http.Handler {
10-
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
11-
log.Printf("%s %s %s\n", r.RemoteAddr, r.Method, r.URL)
12-
handler.ServeHTTP(w, r)
13-
})
11+
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
12+
log.Printf("%s %s %s\n", r.RemoteAddr, r.Method, r.URL)
13+
handler.ServeHTTP(w, r)
14+
})
1415
}
1516

16-
1717
func main() {
18-
// default settings
19-
port := "8080"
20-
dir := os.Getenv("PWD")
18+
// default settings
19+
port := "8080"
20+
dir := os.Getenv("PWD")
2121

22-
// get settings from command line
23-
if len(os.Args) > 1 {
24-
port = os.Args[1]
25-
if len(os.Args) > 2 {
26-
dir = os.Args[2]
27-
}
28-
}
22+
// get settings from command line
23+
if len(os.Args) > 1 {
24+
port = os.Args[1]
25+
if len(os.Args) > 2 {
26+
dir = os.Args[2]
27+
}
28+
}
2929

30-
// start web server with logging
31-
log.Fatal(http.ListenAndServe(":"+port, Log(http.FileServer(http.Dir(dir)))))
30+
// start web server with logging
31+
fmt.Printf("Serving HTTP on 0.0.0.0 port %v ...\n", port)
32+
log.Fatal(http.ListenAndServe(":"+port, Log(http.FileServer(http.Dir(dir)))))
3233
}

0 commit comments

Comments
 (0)