/
main.go
45 lines (37 loc) · 876 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"fmt"
"net/http"
"os"
"gopl.io/ch2/popcount"
"gopl.io/ch2/tempconv"
)
var HTTPClient *http.Client
func arrays() {
/* ab := [...]int{1, 2, 3} */
a := [3]int{1, 2}
fmt.Println(a[0])
for i, v := range a {
fmt.Printf("%d %d\n", i, v)
}
}
func othercrap() {
f := tempconv.Fahrenheit(23)
fmt.Fprintf(os.Stderr, "cf: %v\n", f)
fmt.Fprintf(os.Stderr, "Freezing temp is %v\n", tempconv.FreezingC)
fmt.Fprintf(os.Stdout, "celsius: %v\n", tempconv.FToC(f))
HTTPClient = http.DefaultClient
req, err := http.NewRequest("GET", "http://www.standyck.com", nil)
if err != nil {
fmt.Fprintf(os.Stdout, "err: %v\n", err)
} else {
r, _ := HTTPClient.Do(req)
fmt.Fprintf(os.Stdout, "req: %v\n", req)
fmt.Fprintf(os.Stdout, "response: %v\n", r)
}
z := popcount.PopCount(19235)
fmt.Printf("popcount: %v\n", z)
}
func main() {
arrays()
}