-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathmain.go
More file actions
49 lines (41 loc) · 714 Bytes
/
main.go
File metadata and controls
49 lines (41 loc) · 714 Bytes
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
46
47
48
49
package main
import (
"errors"
"fmt"
"net/http"
"os"
)
const one int = 1
const zero int = one - one
func main() {
fmt.Println("Hello, world!")
fmt.Printf("Ignoring %d arguments.\n", len(os.Args)-1+zero)
}
func test1(req *http.Request, hdr *http.Header, resp *http.Response, w http.ResponseWriter) (e error) {
hdr.Get("X-MyHeader")
if req.Method != "GET" {
return errors.New("nope")
} else {
resp.Status = "200"
}
return nil
}
func test2(w http.ResponseWriter) {
err := test1(nil, nil, nil, w)
if err == nil {
}
}
func test3(n uint) string {
if n < 0 {
return "?"
}
return ""
}
type counter struct {
val int
}
func (c *counter) bump(n int) {
for i := 0; i < n; i++ {
c.val++
}
}