随笔分类 - go
摘要:A:线程是由操作系统管理的(创建, 执行, 销毁), 我们的程序(处于应用层,也叫应用态,或者用户态) 是在操作系统(内核态)之上运行的, B,单核cpu线程的切换,是在不同的时间片上执行的,把cpu执行的1秒钟,切成10毫秒每片,有100个时间段,每个线程轮流执行一个时间片, 就有100个线程可以
阅读全文
摘要:package main import "fmt" type Animal interface{ Talk() Eat() Name() string } type A1 interface{} type Dog struct{} func (d Dog) Talk(){ fmt.Println("
阅读全文
摘要:package main import "fmt" func test(a interface{}){ fmt.Printf("你好啊%#v==%v==%T==%p\n",a,a,a,&a) // 将接口类型的变量转化为具体类型 加个OK 判断, 可以避免程序直接崩溃, ok=false 转行失败
阅读全文
摘要:package main import ( "fmt" "reflect" ) type S struct { A int B string } func (s *S) Test() { fmt.Println("this is a test") } func main() { a:= "12345
阅读全文
摘要:package main //can https://www.jianshu.com/p/4fbf529926ca import ( "fmt" "unicode/utf8" ) func main() { var str = "hello 你好" //golang中string底层是通过byte数
阅读全文
摘要:package main import ( "fmt" ) type People struct { Name string Country string } func (p People)Print(){ fmt.Printf("name=%s country=%s\n",p.Name,p.Cou
阅读全文
摘要:package main import ( "encoding/json" "fmt" ) type Student struct{ Id string Name string Sex string } type Class struct{ Count int Name string Student
阅读全文
摘要:package main import ( "fmt" ) type Integer int func (i Integer) Print() { fmt.Println(i) } func main() { var a Integer a =100 a.Print() var b int=200
阅读全文
摘要:package main import ( "fmt" ) type Animal struct { Name string Sex string } func (a *Animal)Talk(){ fmt.Printf("Animal is talk, i'm %s\n", a.Name) } f
阅读全文
摘要:package main import ( "fmt" "os" //"MyProject/pingguoxueyuan/gostudy/listen13/homework/student_mgr" ) // 把下面这个结构体和函数注释了就不能单独go run 运行了,要go build才能把2个文
阅读全文
摘要:package main import ( "fmt" ) type Address struct { Province string City string CreateTime string } type Email struct { Account string CreateTime stri
阅读全文
摘要:package main import ( "fmt" ) type User struct { Username string Sex string Age int int string } type Address struct { Province string City string } t
阅读全文
摘要:package main import "fmt" func test1() { var a interface{} // 空接口可以实现任何类型的变量 var b int =100 a = b fmt.Printf("test1 00> %T %v \n",a,a) var c string =
阅读全文
摘要:package main import("fmt") type Programer struct { name string base float32 extra float32 } func (p Programer) CalcSalary() float32 { return p.base }
阅读全文
摘要:package main import ( "fmt" "io" "net/http" ) func main(){ //获取服务器应答包内容 resp,err := http.Get( "http://www.baidu.com") if err != nil { fmt.Println( "ht
阅读全文
摘要:package main import ( "fmt" "net/http" "os" ) func OpenSendFile(fName string, w http.ResponseWriter) { //pathFileName := "C:/itcast/test" + fNmae path
阅读全文
摘要:https://blog.csdn.net/flyfreelyit/article/details/80281467 https://blog.csdn.net/qq_27295403/article/details/110469972 https://blog.csdn.net/qq_290611
阅读全文
摘要:web工作万式: 1.客户端——>访问www.baidu.com ——> DNS服务器。返回该域名对应的IP地址。 2.客户端——> IP + port ——>访问网页数据。(TCP连接。HTTP协议。) http和URL: http超文本传输协议。规定了浏览器访问Web服务器进行数据通信的规则。h
阅读全文
摘要:http://www.golang.ren/ https://studygolang.com/pkgdoc https://studygolang.gitbook.io/learn-go-with-tests/
阅读全文
摘要:https://blog.csdn.net/flyfreelyit/article/details/80281467 https://www.cnblogs.com/liyutian/p/10287655.html
阅读全文