使用Golang中遇到的问题

Cross-Origin Read Blocking (CORB) blocked cross-origin response


//值可以设为星号,也可以指定具体主机地址,可设置多个地址用逗号隔开,设为指定主机地址第三项才有效
ctx.Header("Access-Control-Allow-Origin", "*")
//允许请求头修改的类容
ctx.Header("Access-Control-Allow-Headers", "Content-Type")
//允许使用cookie
ctx.Header("Access-Control-Allow-Credentials", "true")

gopm的安装

# git clone https://github.com/gpmgo/gopm.git
# cd gopm && go install
# cp GOPATH/bin/gopm /usr/local/bin

err is shadowed during return

检查代码,查看err是被重定义了