2025年7月18日

go map不能使用指针作为key

摘要: package main import "fmt" type student struct { name string age int } func main() { m := make(map[*student]bool) s1 := &student{ name: "a", age: 17, } 阅读全文

posted @ 2025-07-18 08:16 王景迁 阅读(10) 评论(0) 推荐(0)

go 设置http请求超时时间

摘要: 10.11.12.13不真实存在,ping会超时。 使用 http.Client 设置全局超时 package main import ( "net/http" "time" ) func main() { client := &http.Client{ Timeout: 5 * time.Seco 阅读全文

posted @ 2025-07-18 08:09 王景迁 阅读(40) 评论(0) 推荐(0)

导航