golang
已收录文章:1857篇
-
问题内容 老师我在学习grpc时,使用 protoc-gen-go-grpc 提示:程序未找到或不可执行? 正确答案 protoc-gen-go-grpc是一个用于生成gRPC服务端代码的插件程序,它需要在使用 Protocol Buffers 生成412 收藏
-
问题内容 基本上我想要 的输出df -h,其中包括可用空间和卷的总大小。该解决方案需要在 Windows、Linux 和 Mac 上运行并使用 Go 编写。 我浏览了osand syscallGo 文档并没有找到任何东西。在 Window412 收藏
-
问题内容 假设我有一些这样的代码: value, err := some3rdpartylib.DoSomething() if err != nil { panic(err) } 万一err != nil我会得到这样的东西: panic: some error explanation here goroutine 1 [running]: main.main()412 收藏
-
问题内容 尝试使用 go 与 postgres 数据库通信,准备如下语句: var stmt *sql.Stmt var err error stmt, err = db.Prepare(selectStatement) if err != nil { fmt.Printf("db.Prepare error: %v\n",err) return err } 引412 收藏
-
问题内容 WriteValueBytes can only write while positioned on a Element or Value but is positioned on a TopLevel尝试为 bson.M 创建自定义 mashler/unmashler 时出现错误 我有一个名为 TransactionId 的自定义类型,它表示一411 收藏
-
问题内容 我正在实现一个加载 go 插件的 go 模块。 我假设主包上存在一个具有特定名称和特定签名的函数,并且希望有一个很好的错误消息,以防它找不到或与预期的签名不匹配。 给定一411 收藏
-
问题内容 我有一个这样的结构: type Result struct { Data MyStruct `json:"data,omitempty"` Status string `json:"status,omitempty"` Reason string `json:"reason,omitempty"` }410 收藏
-
问题内容 该main()函数是否作为 goroutine 运行?例如,我看到了一个像下面这样的崩溃堆栈跟踪,这让我问: goroutine 1 [running]: main.binarySearch(0x0, 0x61, 0x43, 0xc420043e70, 0x19, 0x19, 0x10) /home/---/go410 收藏
-
问题内容 xml 文件由两个元素组成。除了一个元素名称之外,这些元素具有相同的结构。我试图为 XMLName 属性设置一个值,但这不起作用。 xml: <!-- first element --> <PERSON> <ELEM1>..410 收藏
-
问题内容 我已经在我的 Ubuntu 桌面上安装了 go,在我关闭计算机之前它运行良好。 现在,当我启动我的机器并继续我的项目工作时,我得到了这个 $ go build go tool: no such tool "compile" go410 收藏
-
问题内容 golang如何收听N个频道? 正确答案 在Go语言中,可以使用select语句来同时收听多个频道。下面是一个示例代码,演示如何收听N个频道并处理它们的消息: package main import ( "fmt410 收藏
-
问题内容 golang如何实现代理设计模式? 正确答案 《Golang设计模式里面》有代理设计模式:https://golang-tech-stack.com/tutorial/design-pattern/dp-proxy 理解代理设计模式关键是:代理和被代理实409 收藏