第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Golang 錯(cuò)誤:未定義:http.NewSingleHostReverseProxy

Golang 錯(cuò)誤:未定義:http.NewSingleHostReverseProxy

Go
catspeake 2021-07-01 10:00:42
我嘗試使用 Golang 構(gòu)建一個(gè)簡(jiǎn)單的程序,這里是:package mainimport (        "net/http"        "net/http/httputil"        "log")func main(){        proxy := http.NewSingleHostReverseProxy( &http.URL{Scheme:"http",Host:"www.google.com",Path:"/"})        err := http.ListenAndServe(":8080", proxy)        if err != nil {                log.Fatal("ListenAndServe: ", err.String())        }}建造:go build myprogram.go輸出:command-line-arguments./myprogram.go:5: imported and not used: "net/http/httputil"./myprogram.go:11: undefined: http.NewSingleHostReverseProxy./myprogram.go:11: undefined: http.URL./myprogram.go:15: err.String undefined (type error has no field or method String)我注意到 http.NewSingleHostReverseProxy 在“net/http/httputil”包中,為什么我會(huì)看到這樣的錯(cuò)誤?也許我需要一個(gè)特定的命令來(lái)正確構(gòu)建它?編輯 后記,這是新的工作代碼:package mainimport (        "net/http"        "net/http/httputil"        "net/url"        "log")func main(){        proxy := httputil.NewSingleHostReverseProxy( &url.URL{Scheme:"http",Host:"www.google.com",Path:"/"})        err := http.ListenAndServe(":8080", proxy)        if err != nil {                log.Fatal("ListenAndServe: ", err)        }}
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 330 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)