ZhangZhihui's Blog  
上一页 1 ··· 64 65 66 67 68 69 70 71 72 ··· 116 下一页

2024年6月11日

摘要: If there are multiple init() functions in a package, don't use in an init() function a global variable that is initialized in another init() function, 阅读全文
posted @ 2024-06-11 19:47 ZhangZhihuiAAA 阅读(18) 评论(0) 推荐(0)
 
摘要: Remember that the biggest advantage you get from using a map[string]interface{} map, or any map that stores an interface{} value in general, is that y 阅读全文
posted @ 2024-06-11 19:27 ZhangZhihuiAAA 阅读(28) 评论(0) 推荐(0)
 
摘要: package main import ( "fmt" "reflect" ) type Secret struct { Username string Password string } type Record struct { Field1 string Field2 float64 Field 阅读全文
posted @ 2024-06-11 17:07 ZhangZhihuiAAA 阅读(15) 评论(0) 推荐(0)
 
摘要: package main import ( "fmt" "maps" ) func delete(k string, v int) bool { return v%2 != 0 } func equal(v1 int, v2 float64) bool { return float64(v1) == 阅读全文
posted @ 2024-06-11 11:35 ZhangZhihuiAAA 阅读(22) 评论(0) 推荐(0)
 
摘要: package main import ( "fmt" "slices" ) func main() { s1 := []int{1, 2, -1, -2} s2 := slices.Clone(s1) fmt.Printf("%p\n", s1) fmt.Printf("%p\n", s2) s1 阅读全文
posted @ 2024-06-11 11:22 ZhangZhihuiAAA 阅读(19) 评论(0) 推荐(0)
 
摘要: 阅读全文
posted @ 2024-06-11 10:12 ZhangZhihuiAAA 阅读(18) 评论(0) 推荐(0)

2024年6月10日

摘要: package main import ( "encoding/csv" "log" "os" ) type Record struct { Name string Surname string Number string LastAccess string } var myData = []Rec 阅读全文
posted @ 2024-06-10 20:58 ZhangZhihuiAAA 阅读(18) 评论(0) 推荐(0)
 
摘要: 阅读全文
posted @ 2024-06-10 20:16 ZhangZhihuiAAA 阅读(8) 评论(0) 推荐(0)
 
摘要: package main import ( crand "crypto/rand" "encoding/base64" "fmt" mrand "math/rand" "strings" ) const ( // As we only want to get printable ASCII char 阅读全文
posted @ 2024-06-10 17:40 ZhangZhihuiAAA 阅读(27) 评论(0) 推荐(0)
 
摘要: package main import ( "fmt" "io" "log" "os" "path" ) func main() { flag := os.O_APPEND | os.O_CREATE | os.O_WRONLY logFile := path.Join(os.TempDir(), 阅读全文
posted @ 2024-06-10 15:36 ZhangZhihuiAAA 阅读(15) 评论(0) 推荐(0)
上一页 1 ··· 64 65 66 67 68 69 70 71 72 ··· 116 下一页