go
已收录文章:911篇
-
问题内容 写了一个收发文件的tcp测试,代码如下 server端 package main import ( //"bytes" "fmt" "io" "math/rand" "net" "os" "time" ) func checkError(err error) { if err != nil { fmt.Fprintf(os.Stde234 收藏
-
问题内容现在因要对接一个平台的api,有一个需求:go中字符串md5后,再base64后,结果与php版的不一样,php代码(请注意:md5中的第二个参数为true,为输出二进~~~~制):$str="hello"; $md5str=md5($str,true); echo bas234 收藏
-
问题内容 官方文档就说了 func Pipe() (Conn, Conn)Pipe创建一个内存中的同步、全双工网络连接。连接的两端都实现了Conn接口。一端的读取对应另一端的写入,直接将数据在两端之间作拷贝;没有内234 收藏
-
问题内容从一个网站上看到的聊天功能,当点击头像时,会调用events接口,之后会返回一个HTTP状态码为201的信息。它这样做的目的是什么?我如果想模仿他的做法,需要做什么?正确答案看上233 收藏
-
问题内容 golang正确的代码风格是什么样子的,我写代码调试时老是提示我,类型不匹配,float不支持int,(ide在写的时候也不提示,而是要到最后编译或者go run后会报错,然后就是回去加类型转233 收藏
-
问题内容我现在的需求是要将一个切片类型的变量值通过 net.Conn.Write 发出去,但是这个方法的参数类型是 []byte 类型的,网上搜了半天,好像没有这方面的文章,于是乎在这里问问,谢谢指点的232 收藏
-
问题内容type A interface { Name() string } type B struct { Age int } func (b B) Name() string { return "" } func main() { b := B{} var a A = &b fmt.Println("a->type:" , reflect.ValueOf(a).Type()) fmt.Println("a232 收藏
-
问题内容刚刚接触go语言,想用go开发一个网站,我需要哪些方面的知识呢??我以前是c++的。没有关注过web方面的东西。希望大牛们指点一下。 正确答案上面的仁兄推荐的这本开源书不错,我就232 收藏
-
问题内容 package main import ( "encoding/xml" "fmt" "io/ioutil" "os" ) type Name struct { XMLName xml.Name `xml:"DomainCheckResult"` Domain string `xml:"Domain"` Available string `xml:"Available"` ErrorNo s230 收藏
-
问题内容 先看一个示例代码: package main import ( "fmt" ) func main() { funcs := [3]string{"test1", "test2", "test3"} var result string for _, v := range funcs { switch v { case "test1": result =229 收藏
-
问题内容hello 各位大佬,我在将json解析成结构体的过程中出现了问题import ( "fmt" jsoniter "github.com/json-iterator/go" ) type Car struct { Other []byte json:"other" } func MyJson() { j := {"other": {"a":[1,2]}} json229 收藏
-
问题内容time.Now().Format("2006.01.02") 这个格式化为什么要用 2006 年 1 月 2 日呢?正确答案完整的格式是2006-01-02 15:04:05是为了好记228 收藏