随笔分类 - go
摘要:背景如题 本地debug go的代码的时候,遇到一个如下的报错 {"errMsg": "Read resultDrivers file error!err:HttpPostParam failed, Error:Post \"http://xxxxx:8000/api\": proxyconnect
阅读全文
摘要: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
阅读全文
摘要:为什么要使用指针? 答:使用指针型变量在很多时候占用更小的内存空间; func main() { a := 10 var za *int za = &a fmt.Println("指针za指的值为:%x\n", *za) fmt.Println("变量地址:%x\n", &a) }
阅读全文
摘要:package main import "fmt" type ListNode struct{ val int next *ListNode } func hasCycle(head *ListNode) bool{ if head == nil || head.next == nil{ retur
阅读全文
摘要: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
阅读全文
摘要:package main import "fmt" type ListNode struct{ Val int Next *ListNode } func ReverseList(pHead *ListNode) *ListNode{ if(pHead == nil || pHead.Next ==
阅读全文
摘要:go环境安装 mac版本 下载地址: https://golang.org/doc/install?download=go1.15.4.darwin-amd64.pkg 傻瓜点击安装后 将/usr/local/go/bin 加入环境变量中 source ~/.bash_profile run hel
阅读全文