go版本: go1.17.5 linux/amd64
执行go get报错:
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
表示缺少go.mod文件,那么退回到工程上一级目录,并执行: go mod init project_name
go: creating new go.mod: module project_name
go: to add module requirements and sums:
go mod tidy
则继续执行 go mod tidy ,下载依赖项目,有以下项目:
go: finding module for package github.com/btcsuite/btcd/chaincfg
go: finding module for package github.com/btcsuite/btcd/btcec
go: downloading github.com/btcsuite/btcd v0.22.0-beta
go: finding module for package github.com/btcsuite/btcutil
go: downloading github.com/btcsuite/btcutil v1.0.2
go: finding module for package github.com/ethereum/go-ethereum/crypto
go: downloading github.com/ethereum/go-ethereum v1.10.13
go: found github.com/btcsuite/btcd/btcec in github.com/btcsuite/btcd v0.22.0-beta
go: found github.com/btcsuite/btcd/chaincfg in github.com/btcsuite/btcd v0.22.0-beta
go: found github.com/btcsuite/btcutil in github.com/btcsuite/btcutil v1.0.2
go: found github.com/ethereum/go-ethereum/crypto in github.com/ethereum/go-ethereum v1.10.13
go: downloading github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
go: downloading golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912
然后进行项目文件夹下,执行 go get 和 go build
若go mod tidy因socks代理问题无法拉取,则需要配置git的socks代理
git config --global http.proxy=socks5://localhost:12345
git config --global https.proxy=socks5://localhost:12345
我的git global配置(使用git config --global --list查看)
user.email='123@gmail.com'
user.name='123'
filesystem.Oracle Corporation|1.8.0_241|683316624.timestampresolution=1001 micro
seconds
filesystem.Oracle Corporation|1.8.0_241|683316624.minracythreshold=0 nanoseconds
filesystem.Oracle Corporation|1.8.0_241|-687997969.timestampresolution=36001 mic
roseconds
filesystem.Oracle Corporation|1.8.0_241|-687997969.minracythreshold=0 nanosecond
s
https.proxy=socks5://localhost:12345
filesystem.Oracle Corporation|1.8.0_281|683316624.timestampresolution=1001 micro
seconds
filesystem.Oracle Corporation|1.8.0_281|683316624.minracythreshold=0 nanoseconds
filesystem.Oracle Corporation|1.8.0_281|-687997969.timestampresolution=3001 micr
oseconds
filesystem.Oracle Corporation|1.8.0_281|-687997969.minracythreshold=0 nanosecond
s
http.proxy=socks5://localhost:12345