go学习

1. 启用go mod,设置GOPROXY

export GO111MODULE=on
export GOPROXY=https://goproxy.io

通过设置GOPROXY,可以一键解决 go get golang.org/x 包失败

2. 查看依赖包

jeffreyguan@jeguan ~/myto$ go list -m -u -json all                                                                                                                        
{
	"Path": "github.com/you/hello",
	"Main": true,
	"Dir": "/Users/jeffreyguan/myto",
	"GoMod": "/Users/jeffreyguan/myto/go.mod",
	"GoVersion": "1.12"
}
{
	"Path": "golang.org/x/text",
	"Version": "v0.0.0-20170915032832-14c0d48ead0c",
	"Time": "2017-09-15T03:28:32Z",
	"Update": {
		"Path": "golang.org/x/text",
		"Version": "v0.3.2",
		"Time": "2019-04-25T21:42:06Z"
	},
	"Indirect": true,
	"Dir": "/Users/jeffreyguan/go/pkg/mod/golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c",
	"GoMod": "/Users/jeffreyguan/go/pkg/mod/cache/download/golang.org/x/text/@v/v0.0.0-20170915032832-14c0d48ead0c.mod"
}
{
	"Path": "rsc.io/quote",
	"Version": "v1.5.2",
	"Time": "2018-02-14T15:44:20Z",
	"Dir": "/Users/jeffreyguan/go/pkg/mod/rsc.io/quote@v1.5.2",
	"GoMod": "/Users/jeffreyguan/go/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod"
}
{
	"Path": "rsc.io/sampler",
	"Version": "v1.3.0",
	"Time": "2018-02-13T19:05:03Z",
	"Update": {
		"Path": "rsc.io/sampler",
		"Version": "v1.99.99",
		"Time": "2018-02-13T22:20:19Z"
	},
	"Indirect": true,
	"Dir": "/Users/jeffreyguan/go/pkg/mod/rsc.io/sampler@v1.3.0",
	"GoMod": "/Users/jeffreyguan/go/pkg/mod/cache/download/rsc.io/sampler/@v/v1.3.0.mod"
}

3. go module

https://stackoverflow.com/questions/52026284/accessing-local-packages-within-a-go-module-go-1-11

4. 学习资料

https://gobyexample.com/
https://tour.go-zh.org/welcome/1

5. go websocket

go websocket, a better way to buid your IM server
https://github.com/fanux/fist 

监控文件内容的变化,当有变化时会以流式的方式打到浏览器中
https://github.com/gorilla/websocket/tree/master/examples/filewatch

6. go echo

https://echo.labstack.com/cookbook/websocket

支持websocket, 文件上传下载

posted @ 2019-07-21 10:35  大海星  阅读(209)  评论(0编辑  收藏  举报