上一页 1 2 3 4 5 6 ··· 13 下一页
摘要: go package main import "sync" import "fmt" import "time" type Worker struct { id string } func (w Worker) String() string { return w.id } var globalCo 阅读全文
posted @ 2018-03-27 00:47 cucy_to 阅读(187) 评论(0) 推荐(0)
摘要: go package main import ( "fmt" "sync" "time" ) var names = []interface{}{"Alan", "Joe", "Jack", "Ben", "Ellen", "Lisa", "Carl", "Steve", "Anton", "Yo" 阅读全文
posted @ 2018-03-27 00:42 cucy_to 阅读(201) 评论(0) 推荐(0)
摘要: go package main import ( "fmt" "sync" ) var names = []string{"Alan", "Joe", "Jack", "Ben", "Ellen", "Lisa", "Carl", "Steve", "Anton", "Yo"} func main( 阅读全文
posted @ 2018-03-27 00:37 cucy_to 阅读(127) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "sync" ) var names = []string{"Alan", "Joe", "Jack", "Ben", "Ellen", "Lisa", "Carl", "Steve", "Anton", "Yo"} type Sy 阅读全文
posted @ 2018-03-27 00:31 cucy_to 阅读(124) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "net/http" ) type StringServer string func (s StringServer) ServeHTTP(rw http.ResponseWriter, req *http.Request) { fmt.Printf("Prior ParseForm: %v\n", req.Form... 阅读全文
posted @ 2018-03-27 00:27 cucy_to 阅读(120) 评论(0) 推荐(0)
摘要: ```go Prepare the private key and self-signed X-509 certificate. For this purpose, the OpenSSL utility could be used. By executing the command openssl genrsa -out server.key 2048, the private key deri... 阅读全文
posted @ 2018-03-27 00:24 cucy_to 阅读(331) 评论(0) 推荐(0)
摘要: ```go package main import ( "context" "fmt" "log" "net/http" "os" "os/signal" "time" ) func main() { mux := http.NewServeMux() mux.HandleFunc("/", fun 阅读全文
posted @ 2018-03-27 00:21 cucy_to 阅读(232) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "log" "net/http" "time" ) const cookieName = "X-Cookie" func main() { log.Println("Server is starting...") http.HandleFunc("/set", func(w http.ResponseWrite... 阅读全文
posted @ 2018-03-27 00:17 cucy_to 阅读(109) 评论(0) 推荐(0)
摘要: ```go package main import ( "fmt" "log" "net/http" ) func main() { log.Println("Server is starting...") http.Handle("/secured/handle", http.RedirectHa 阅读全文
posted @ 2018-03-27 00:14 cucy_to 阅读(163) 评论(0) 推荐(0)
摘要: ```go ➜ recipe08 cat template.tpl Hi, I'm {{.}}! ``` ```go package main import "net/http" import "html/template" import "fmt" func main() { fmt.Println("Server is starting..."... 阅读全文
posted @ 2018-03-27 00:10 cucy_to 阅读(114) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 13 下一页