go get失败时怎么办(golang.org/x/crypto/md4为例)

参考

https://www.cnblogs.com/hupeng1234/p/9727170.html

https://blog.csdn.net/u013710468/article/details/88526200

 

golang unrecognized import path 完美解决方

https://blog.csdn.net/Yuhao818/article/details/100557931

解决unrecognized import path "golang.org/x/..问题

https://blog.csdn.net/cyLee_/article/details/93159032

https://www.bbsmax.com/A/Gkz1QwbrzR/

https://www.rootop.org/pages/4331.html

mkdir -p $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/sync.git
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/tools.git tools

go install golang.org/x/tools/...

 

首先,我们知道

go get = git clone + go install

 

go get 命令本质上可以理解为:首先通过源码工具clone代码到src目录,然后执行go install。

 

比如

go get -u -v golang.org/x/crypto/md4失败

此时我们先

mkdir $GOPATH/src/golang.org/x -p
cd  $GOPATH/src/golang.org/x

git clone https://github.com/golang/crypto.git

go install golang.org/x/crypto/...

报错

crypto\acme\autocert\autocert.go:35:2: cannot find package "golang.org/x/net/idna" in any of:
        D:\Go\src\golang.org\x\net\idna (from $GOROOT)
        D:\gopath\src\golang.org\x\net\idna (from $GOPATH)
crypto\blake2b\blake2bAVX2_amd64.go:9:8: cannot find package "golang.org/x/sys/cpu" in any of:
        D:\Go\src\golang.org\x\sys\cpu (from $GOROOT)
        D:\gopath\src\golang.org\x\sys\cpu (from $GOPATH)
crypto\ssh\terminal\util_windows.go:22:2: cannot find package "golang.org/x/sys/windows" in any of:
        D:\Go\src\golang.org\x\sys\windows (from $GOROOT)
        D:\gopath\src\golang.org\x\sys\windows (from $GOPATH)

git clone https://github.com/golang/sys.git
go install golang.org/x/sys/...

git clone https://github.com/golang/net.git ./golang.org/x/net

git clone https://github.com/google/go-genproto.git ./google.golang.org/genproto

 go install golang.org/x/crypto/...  

报错
git clone https://github.com/golang/text.git ./golang.org/x/text

go install golang.org/x/crypto/... 

成功。。。。。。

你可能感兴趣的:(go)