Go语言中文网 为您找到相关结果 13

Go test 测试单个用例

通过 go help testflag 可以看出,可以使用 test.run 加正在表达式来指定要测试的用例。 如有以下用例在包 foo/test 中: func TestFoo(t *testing.T){} func TestFoo1(t *testing.T){} func TestAbc(t *testing.T){} go test -v foo/test 将测试所有的用例 (-v 表示输出详细信息,无论成功失败) go test -v -run TestFoo foo/test 将测试 TestFoo 和 TestFoo1 go test -v -run ^TestFoo$ foo/test 将只测试 TestFo...阅读全文

golang zlib 压缩数据

package main import ( "fmt" "compress/zlib" "bytes" ) func main() { var input = []byte("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKsAAAAgCAYAAABtn4gCAAAI9klEQVR4Xu2cfYxcVRmHn3Pu3Nm6lXa2ta0AYlsgFSGgThMU0W5hGkqApNGARk3cGm3BRN3FYGuCISrBXaNphcSkG2I3hn9gY2gSNWq32AoE1C6KRihFti2QSgvsTmm783HvOa+zM69cSS8Tacsq7n2SX87cj5P7ZvLs2ztnbseICG8HMjIsbxMyMnIoxhja...阅读全文

博文 2014-10-04 19:26:09 zitsing

关于beego-httpbib库的不解问题,请求大家支援

#### 关于 > 使用了beego 的 httplib 请求库 #### 场景 > 对数据进行加密处理,然后以字符串类型发送给webservice 进行请求,拿到返回数据打印 #### 问题 > 出现了发送相同的请求体,不同请求结果 #### 简略分析说明 代码如下: ``` // new request req := httplib.NewBeegoRequest(host+baseUrl, method) setHeader(req) // 要加密的数据 _params := `{"phone":"13662676666","password":"e10adc3949ba59abbe56e057f20f883e","rememberLogin":"true"}` // 简单加密, 拿到...阅读全文

博文 2018-09-21 12:40:53 josenspire

kubelet启动失败——inotify

参考issue This error (ENOSPC) comes from the inotify_add_watch syscall, and actually has multiple meanings (the message comes from golang). Most likely the problem is from exceeding the maximum number of watches, not filling the disk. This can be increased with the fs.inotify.max_user_watches sysctl, but I would investigate what else is creating so m...阅读全文

博文 2018-11-06 12:34:40 陈先生_9e91

Object-oriented

Method belog to struct package mainimport ( "fmt" "math")type Rectangle struct{ width, height float64}type Circle struct { radius float64}func (r Rectangle) area(){ return r.width*r.height}func (c Circle) area(){ return c.radius * c.radius * math.Pi}func main(){ r1 := Rectangle{12,2} c1 := Circle{10} fmt.Println("Area of r1 is: ",r1.area())} Noted:...阅读全文

博文 2018-10-24 01:34:39 曹小恒