go http2 server push 及client push handle 示例
1、项目初始化
在GOPATH之外,创建一个新目录,并使用go mod init 初始化go.mod文件
sudo mkdir -p /opt/workspace/gomod/http2demo
cd /opt/workspace/gomod/http2demo
sudo go mod init github.com/custhk/http2demo
其它go mod命令
命令 | 说明 |
---|---|
init | initialize new module in current directory(在当前目录初始化mod) |
download | download modules to local cache(下载依赖包) |
edit | edit go.mod from tools or scripts(编辑go.mod) |
tidy | add missing and remove unused modules(拉取缺少的模块,移除不用的模块) |
graph | print module requirement graph (打印模块依赖图) |
vendor | make vendored copy of dependencies(将依赖复制到vendor下) |
verify | verify dependencies have expected content (验证依赖是否正确) |