我是Go的新手.从文档中尝试了第一个hello,world,并希望从请求中读取Host和Scheme:
package hello
import (
"fmt"
"http"
)
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Host: " + r.URL.Host + " Scheme: " + r.URL.Scheme)
}
Run Code Online (Sandbox Code Playgroud)
但他们的价值观都是空白的.为什么?