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

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

如何在openshift中向golang添加外部包

如何在openshift中向golang添加外部包

Go
猛跑小豬 2021-09-09 13:47:38
我將如何在運(yùn)行 golang 的 openshift 中安裝 github.com/gorilla/mux。我知道在本地我們確實(shí)去獲取并安裝。openshift 的等價(jià)物是什么。給出的代碼在我的電腦上運(yùn)行良好。但是在實(shí)時(shí)站點(diǎn)中給出 503 Service Unavailable。package mainimport (    "github.com/gorilla/mux"    "fmt"    "net/http"    "os"    "io/ioutil"    )func homeHandler(res http.ResponseWriter, req *http.Request) {    http.ServeFile(res,req, "home/index.html")}func dataHandler(res http.ResponseWriter, req * http.Request){    params:= mux.Vars(req)    fName,_:=params["fname"]    res.Header().Set("Access-Control-Allow-Origin", "*")    contents,_ := ioutil.ReadFile("home/data/"+fName)    res.Header().Set("Content-Type", "application/json")    res.Write(contents)}func main() {    r := mux.NewRouter()    r.PathPrefix("/home/css/").Handler(http.StripPrefix("/home/css/",http.FileServer(http.Dir("home/css/"))))    r.PathPrefix("/home/lib/").Handler(http.StripPrefix("/home/lib/",http.FileServer(http.Dir("home/lib/"))))    r.PathPrefix("/home/views/").Handler(http.StripPrefix("/home/views/",http.FileServer(http.Dir("home/views/"))))    r.PathPrefix("/home/images/").Handler(http.StripPrefix("/home/images/",http.FileServer(http.Dir("home/images/"))))    r.HandleFunc("/home/data/{fname:.+}", dataHandler)    r.HandleFunc(`/home/{name:.*}`,homeHandler)    http.Handle("/", r)    bind := fmt.Sprintf("%s:%s", os.Getenv("HOST"), os.Getenv("PORT"))    fmt.Printf("listening on %s...", bind)    err := http.ListenAndServe(bind, nil)    if err != nil {        panic(err)    }
查看完整描述

2 回答

?
呼如林

TA貢獻(xiàn)1798條經(jīng)驗(yàn) 獲得超3個(gè)贊

盡管我沒有使用 openshift 的經(jīng)驗(yàn),但通常您會(huì)希望提供您的依賴項(xiàng)。通過這樣做,您可以確保您的應(yīng)用程序可以使用正確的版本,而不必?fù)?dān)心 openshifts(或任何其他應(yīng)用程序平臺(tái))自己的構(gòu)建系統(tǒng)。


查看完整回答
反對(duì) 回復(fù) 2021-09-09
  • 2 回答
  • 0 關(guān)注
  • 194 瀏覽
慕課專欄
更多

添加回答

舉報(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)