摘要:
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数 阅读全文