摘要:
之前用brew装的go1.18。brew最新只能装到1.18 由于想装1.20所以又在go官网下载了1个1.20版本 在/usr/local/go go 官网镜像网址https://golang.google.cn/dl/ 安装完之后 go version 还是之前的版本 这是因为之前装了brew的 阅读全文
摘要:
原文链接:https://blog.csdn.net/joychenwenyu/article/details/126935706 进入正题 1、首先在main函数前添加描述: 准备工作 引入swaggo依赖: ## swagger 依赖go get "github.com/swaggo/files 阅读全文
摘要:
本文参考链接 https://blog.csdn.net/jwsl999/article/details/120196536 https://blog.csdn.net/Jjs_Object/article/details/119914241 https://blog.csdn.net/weixin 阅读全文
摘要:
服务端 创建server.go文件。详见demo82 package mainimport ( "fmt" "net" "net/rpc")//定义类对象type World struct {}//绑定类方法func (this *World) HelloWorld(name string, res 阅读全文
摘要:
获取本地ip地址 ifconfig en0 192.168.31.35. 这边的ip地址在下面的ip会使用到 拉取镜像 docker pull wurstmeister/zookeeperdocker pull wurstmeister/kafka 启动容器 启动 zookeeper docker 阅读全文
摘要:
示例demo55 package main import ( "fmt" "time" ) func main() { intChan := make(chan int, 10) //初始化 intchan 通道 长度10 intChan2 := make(chan int, 10) //初始化 i 阅读全文
摘要:
示例demo52 package main import ( "fmt" ) //taskChan <-chan 只读 //resChan chan<- 只写 //exitChan chan<- 只写 func calc(taskChan chan int, resChan chan int, ex 阅读全文
摘要:
示例demo51 package main import ( "fmt" "time" ) func sendData(ch chan int) { //把数据写到通道里 for i := 0; i < 20; i++ { ch <- i fmt.Println("push data:", i) } 阅读全文
摘要:
//示例45 package main import "fmt" func main() { var intlink Link for i := 0; i < 10; i++ { intlink.InsertTail(i) } intlink.Trans() } //节点 type LinkNode 阅读全文
摘要:
package main import ( "fmt" "math/rand" "sort" ) //学生结构体 type Student struct { Name string Id string Age int } type StudentArray []Student // 实现sort 接 阅读全文