golang
已收录文章:13862篇
-
问题内容 我无法将 WebSocket 服务器放入 Docker 容器中。 这是服务器代码,它使用“已连接”写入新连接。 // server.go func RootHandler(w http.ResponseWriter, r *http.Request) { upgrader := websocket.Upgrader{ //204 收藏
-
问题内容 我有一片结构。 type Config struct { Key string Value string } // I form a slice of the above struct var myconfig []Config // unmarshal a response body into the above slice if err := json.Unmarshal(respbody, &myconf136 收藏
-
问题内容 我有一些代码我已经被倾倒并且实际上被难住了 - 我以前使用过 RPC 和 JSON 方面的东西,但是当它在本地工作正常时,我似乎无法让它在 RPC 上工作。 package main import ( "log&qu266 收藏
-
问题内容 我知道 Go 中没有析构函数,因为从技术上讲没有类。因此,我initClass用来执行与构造函数相同的功能。但是,有没有办法在终止时创建一些东西来模仿析构函数,例如关闭文件?501 收藏
-
问题内容 构建我的第一个 Web 应用程序并希望更好地理解 SQL 注入 ( [https://github.com/ataxie/build-web- application-with- golang/blob/master/en/eBook/09.4.md](https://github.com/astaxie/build-web- application-with-golang/blob/463 收藏
-
问题内容 我在字符串列表的 json.Marshal 上得到了这个: json: invalid UTF-8 in string: "...ole\xc5\" 原因很明显,但是如何在 Go 中删除/替换此类字符串?我一直在阅读文档unicode和unicode/utf8软475 收藏