58同城舊房翻新愛站seo工具包下載
今天是開始學(xué)go的第x天,前些日子看了看語言,今天找一個(gè)web開發(fā)來跟著學(xué),記錄一下遇到的問題,方便以后復(fù)習(xí)查閱。
視頻看的是https://www.bilibili.com/video/BV1gJ411p7xC?p=3&vd_source=ab5bdbd04f4142027c66d604d5285204
?視頻中用的是goland,我用的vs
如何在vs中建一個(gè)項(xiàng)目:
https://blog.csdn.net/sepnineth/article/details/125153354
這也是為了解決一個(gè)報(bào)錯(cuò):
go.mod file not found in current directory or any parent directory.'go get' is no longer supported outside a module.To build and install a command, use 'go install' with a version,like 'go install example.com/cmd@latest'For more information, see https://golang.org/doc/go-get-install-deprecationor run 'go help get' or 'go help install'.
因?yàn)橄螺dgin的時(shí)候會報(bào)錯(cuò),就是這個(gè)命令:go get -u github.com/gin-gonic/gin
初次嘗試go寫一個(gè)網(wǎng)頁還是挺有意思的
package mainimport ("fmt""net/http"
)func sayHello(w http.ResponseWriter, r *http.Request) {_, _ = fmt.Fprintln(w, "Hello jzy")
}func main() {http.HandleFunc("/hello", sayHello)err := http.ListenAndServe(":9090", nil)if err != nil {fmt.Printf("http server failed, err:%v\n", err)return}
}