英文: How to pass net/http to other package 问题 我使用以下代码片段来创建一个HTTP服务器。 在主包中: http.HandleFunc("/aa...
Go using timeouts with channels
英文: Go using timeouts with channels 问题 我正在使用goroutines/channels来检查一组URL是否可达。以下是我的代码。这段代码似乎总是返回true。为...
无法从`[]interface{}`断言为`[]string`类型。
英文: Unable to assert type `[]string` from `[]interface{}` 问题 我正在尝试处理从mongodb (mgo)检索到的一些数据。 不幸的是,我无法...
在Go语言中,是否有一种更通用的方法来实现两种堆(最大堆和最小堆)?
英文: Is there a more generic way to implement 2 kinds of Heap (Max and Min) in Go Lang 问题 目前,Go语言文档中的...
如何通过加锁实现Go中的线程安全映射包装器?
英文: How can one implement a thread-safe wrapper to maps in Go by locking? 问题 我正在尝试将一个通用的映射(使用interfa...
为什么我不能将一个新分配的字节数组赋值给一个类型为 []byte 的变量?
英文: why cannot I assign a newly allocated byte array to a variable with []byte as type? 问题 我正在尝试声明一个...
在运行命令时,如何从Go的附加文件描述符中读取数据?
英文: How to read from Go additional file descriptors when running a command 问题 假设我有一个程序,它在文件描述符3上输出内容...
在Go语言中生成指定范围内的随机数。
英文: Generating random numbers over a range in Go 问题 math/rand中的所有整数函数都生成非负数。 rand.Int() int // [0, M...
当比较基准时,Go和Ruby哪个更慢?
英文: When comparing benchmarks, is Go or Ruby slower? 问题 我对学习Go语言很感兴趣,而且我已经用Ruby编程有一段时间了。在比较基准测试时,哪种语...
你可以使用github.com/golang/appengine来访问Datastore。
英文: How do I access Datastore using github.com/golang/appengine? 问题 我正在使用github.com/golang/appengine...
364