go get 时报告“using incompatible versions of the cygwin DLL”问题的解决

问题

src>go get -u -v github.com/gorilla/websocket
github.com/gorilla/websocket (download)
	  0 [main] sh (6776) C:\Git\usr\bin\sh.exe: *** fatal error - cygheap base mismatch detected - 0xB26410/0x
BB6410.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version.  The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution.  Rebooting is also suggested if you
are unable to find another cygwin DLL.
	  1 [main] sh 5452 fork: child -1 - forked process 6776 died unexpectedly, retry 0, exit code 0xC0000005, errno 11
	  0 [main] sh (7968) C:\Git\usr\bin\sh.exe: *** fatal error - cygheap base mismatch detected - 0xB26410/0x
8D6410.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version.  The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution.  Rebooting is also suggested if you
are unable to find another cygwin DLL.
1048144 [main] sh 5452 fork: child -1 - forked process 7968 died unexpectedly, retry 0, exit code 0xC0000005, errno 11
	  0 [main] sh (7856) C:\Git\usr\bin\sh.exe: *** fatal error - cygheap base mismatch detected - 0xB26410/0x
B36410.
...
33691043 [main] sh 5452 fork: child -1 - forked process 4928 died unexpectedly, retry 0, exit code 0xC0000005, errno 11
/mingw32/libexec/git-core/git-sh-setup: fork: Resource temporarily unavailable
package github.com/gorilla/websocket: exit status 254

安装cygwin

(1) 从官网www.cygwin.com/下载安装引导文件 setup-x86.exe(我的windows是32位的,64位的下载setup-x64.exe)

(2) 在选择镜像界面,填写国内镜像 https://mirrors.aliyun.com/cygwin/ (或163的镜像,速度也很快)

(3) Next, 直到安装完毕

提示: 事实上,上述错误与cygwin没有啥子关系。

测试go get,问题依旧存在

src>go get -u -v github.com/gorilla/websocket
...

解决问题

线索

按https://stackoverflow.com/questions/12042363/cygwin-git-fork-error-on-pull,或许是Git工具版本的问题 (与go工具链不匹配?)

查看git版本

src>
src>git --version
git version 2.16.2.windows.1

从官网下载最新的版本

下载地址 https://github.com/git-for-windows/git/releases/
官网最新版本也只到2.20.0,2.16.2已经很新了。
抱着试试看的态度,下载最新版本,安装

查看git版本

src>git --version
it version 2.20.0.rc2.windows.1

测试go get,通过

src>
src>go get -u -v github.com/gorilla/websocket
github.com/gorilla/websocket (download)
github.com/gorilla/websocket
src>

你可能感兴趣的:(IoT,Go,知识&技巧)