go install

go install: cannot install cross-compiled binaries when GOBIN is set

Golang报错整理_sqlite

go build

# github.com/mattn/go-sqlite3
..\github.com\mattn\go-sqlite3\sqlite3_opt_preupdate.go:12:16: undefined: SQLiteConn
..\github.com\mattn\go-sqlite3\sqlite3_opt_preupdate_omit.go:19:10: undefined: SQLiteConn
go install: cannot install cross-compiled binaries when GOBIN is set

Golang报错整理_github_02


导入elasticsearch包错误

Golang报错整理_github_03


main.go:1:1: expected 'package', found 'EOF'

解决:ctrl+s保存下就可以了


go build

main.go:7:2: no required module provides package github.com/olivere/elastic/v7; to add it:


解决:下载对应的包

go get github.com/olivere/elastic/v7

在下载依赖包的时候出现错误
go get: module github.com/olivere/elastic/v7: Get "https://proxy.golang.org/github.com/olivere/elastic/v7/@v/list": dial tcp 142.251.43.17:443: connect: connection refused

解决:设置代理,重新下载

go env -w GOPROXY=https://goproxy.cn
go get github.com/olivere/elastic/v7


go get 下载github项目报错

Golang报错整理_sqlite_04

PS C:\work> go get  github.com/gin-gonic/gin    
# cd .; git clone -- https://github.com/gin-gonic/gin C:\work\src\github.com\gin-gonic\gin
Cloning into 'C:\work\src\github.com\gin-gonic\gin'...
fatal: unable to access 'https://github.com/gin-gonic/gin/': OpenSSL SSL_read: Connection was reset, errno 10054
package github.com/gin-gonic/gin: exit status 128

解决:

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn
go get github.com/gin-gonic/gin