先下载源码 https://github.com/liangdas/mqantserver。
假设设置环境变量
GOPATH D:\Go 工作目录
GOROOT D:\ProgramFiles\Go 安装目录
用VsCode打开GOPATH/src/mqantserver (可以先打开任意一个go文件,然后从下图左上角点击Open Folder)
编辑D:\Go\src\github.com\liangdas\mqant\app\app.go文件 去掉一个斜杠
编辑D:\Go\src\mqantserver\bin\conf\server.json 可以写为绝对路径D:\Go\src\mqantserver
为了方便在任意文件状态下都能F5调试,
把 main.go从D:\Go\src\mqantserver\src\server剪切到D:\Go\src\mqantserver\ 来。
如果出现 nats agent: nats: no servers available for connection 则
cd D:\Go\src
go get -v github.com/nats-io/nats-server
go install github.com/nats-io/nats-server
先运行D:\Go\bin\nats-server.exe
如出现
[ERR] consul.watch: Watch (type: services) errored: Get http://127.0.0.1:8500/v1/catalog/services: dial tcp 127.0.0.1:8500: connectex: No connection could be made because the target machine actively refused it., retry in 5s
go get -v github.com/hashicorp/consul
go install github.com/hashicorp/consul
先运行D:\Go\bin\consul.exe 要带参数用cmd命令行(不要用PowerShell)
consul agent -dev -bind=0.0.0.0
就可以编译调试运行mqantserver了,浏览器输入http://127.0.0.1:8080/mqant/chat/即可访问。