gofmt
This commit is contained in:
parent
5242d9c677
commit
fe4b7ffd45
@ -9,9 +9,8 @@ import "fmt"
|
|||||||
func f(n int) {
|
func f(n int) {
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
fmt.Println(n, ":", i)
|
fmt.Println(n, ":", i)
|
||||||
breakTime := time.Duration(rand.Intn(150)))
|
breakTime := time.Duration(rand.Intn(150))
|
||||||
time.Sleep(time.Millisecond * breakTime)
|
time.Sleep(time.Millisecond * breakTime)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,9 +63,10 @@ func generateWrites(writes chan *writeOp) {
|
|||||||
for {
|
for {
|
||||||
key := randKey()
|
key := randKey()
|
||||||
val := randVal()
|
val := randVal()
|
||||||
write := &writeOp{key: key,
|
write := &writeOp{
|
||||||
val: val,
|
key: key,
|
||||||
resp: make(chan bool)}
|
val: val,
|
||||||
|
resp: make(chan bool)}
|
||||||
writes <- write
|
writes <- write
|
||||||
<-write.resp
|
<-write.resp
|
||||||
atomic.AddInt64(&opCount, 1)
|
atomic.AddInt64(&opCount, 1)
|
||||||
|
@ -6,7 +6,7 @@ import "fmt"
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
arr := []byte("some bytes")
|
arr := []byte("some bytes")
|
||||||
str := string([]byte{'a',' ','s','t','r','i','n','g'})
|
str := string([]byte{'s', 't', 'r', 'i', 'n', 'g'})
|
||||||
fmt.Println(arr)
|
fmt.Println(arr)
|
||||||
fmt.Println(str)
|
fmt.Println(str)
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ func wrapLogging(f http.HandlerFunc) http.HandlerFunc {
|
|||||||
path := req.URL.Path
|
path := req.URL.Path
|
||||||
elapsed := float64(time.Since(start)) / 1000000.0
|
elapsed := float64(time.Since(start)) / 1000000.0
|
||||||
logs <- fmt.Sprintf("method=%s path=%s elapsed=%f",
|
logs <- fmt.Sprintf("method=%s path=%s elapsed=%f",
|
||||||
method, path, elapsed)
|
method, path, elapsed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ func testAuth(r *http.Request, auth Auth) bool {
|
|||||||
|
|
||||||
func requireAuth(w http.ResponseWriter, r *http.Request) {
|
func requireAuth(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("WWW-Authenticate",
|
w.Header().Set("WWW-Authenticate",
|
||||||
"Basic realm=\"private\"")
|
"Basic realm=\"private\"")
|
||||||
w.WriteHeader(401)
|
w.WriteHeader(401)
|
||||||
w.Write([]byte("401 Unauthorized\n"))
|
w.Write([]byte("401 Unauthorized\n"))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user