随笔分类 -  go

摘要:背景如题 本地debug go的代码的时候,遇到一个如下的报错 {"errMsg": "Read resultDrivers file error!err:HttpPostParam failed, Error:Post \"http://xxxxx:8000/api\": proxyconnect 阅读全文
posted @ 2021-06-09 15:33 威威后花园 阅读(268) 评论(0) 推荐(0) 编辑
摘要:divison.go package mytest import "errors" func Division(a, b float64) (float64, error) { if b == 0{ return 0, errors.New("除数不能为0") } return a / b, nil 阅读全文
posted @ 2020-12-01 20:39 威威后花园 阅读(81) 评论(0) 推荐(0) 编辑
摘要:为什么要使用指针? 答:使用指针型变量在很多时候占用更小的内存空间; func main() { a := 10 var za *int za = &a fmt.Println("指针za指的值为:%x\n", *za) fmt.Println("变量地址:%x\n", &a) } 阅读全文
posted @ 2020-11-30 18:08 威威后花园 阅读(69) 评论(0) 推荐(0) 编辑
摘要:package main import "fmt" type ListNode struct{ val int next *ListNode } func hasCycle(head *ListNode) bool{ if head == nil || head.next == nil{ retur 阅读全文
posted @ 2020-11-27 20:42 威威后花园 阅读(216) 评论(0) 推荐(0) 编辑
摘要:package main import "fmt" func upper_bound_ (v int, a[] int) int{ len_a := len(a) left := 0 right := len_a - 1 for { mid := left + (right - left) / 2 阅读全文
posted @ 2020-11-27 11:20 威威后花园 阅读(56) 评论(0) 推荐(0) 编辑
摘要:package main import "fmt" type ListNode struct{ Val int Next *ListNode } func ReverseList(pHead *ListNode) *ListNode{ if(pHead == nil || pHead.Next == 阅读全文
posted @ 2020-11-26 12:03 威威后花园 阅读(169) 评论(0) 推荐(0) 编辑
摘要:go环境安装 mac版本 下载地址: https://golang.org/doc/install?download=go1.15.4.darwin-amd64.pkg 傻瓜点击安装后 将/usr/local/go/bin 加入环境变量中 source ~/.bash_profile run hel 阅读全文
posted @ 2020-11-09 11:40 威威后花园 阅读(116) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示