关于Windows上安装gin的问题

  最近在上手gin这个框架,可是安装过程中出了一些问题,当问题解决了,我们也来vlog一下。
如果我们按部就班的去

go get github.com/gin-gonic/gin

这样子去下载gin以及它的一些依赖的话,它会报这个错误

unrecognized import path "google.golang.org/protobuf/encoding/prototext": https fetch: Get "https://google.golang.org/protobuf/encoding/prototext?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
unrecognized import path "google.golang.org/protobuf/encoding/protowire": https fetch: Get "https://google.golang.org/protobuf/encoding/protowire?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
unrecognized import path "google.golang.org/protobuf/proto": https fetch: Get "https://google.golang.org/protobuf/proto?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
unrecognized import path "google.golang.org/protobuf/reflect/protoreflect": https fetch: Get "https://google.golang.org/protobuf/reflect/protoreflect?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
unrecognized import path "google.golang.org/protobuf/reflect/protoregistry": https fetch: Get "https://google.golang.org/protobuf/reflect/protoregistry?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
unrecognized import path "google.golang.org/protobuf/runtime/protoiface": https fetch: Get "https://google.golang.org/protobuf/runtime/protoiface?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
unrecognized import path "google.golang.org/protobuf/runtime/protoimpl": https fetch: Get "https://google.golang.org/protobuf/runtime/protoimpl?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

首先,遇到错误,我们不要慌,一定要冷静下来,我们看一下它的大概意思,基本上就是,我们在gopath下缺少这个目录,在这个目录下缺少这个protobuf文件,因此,我们只需要在gopath下去新建这个目录,然后执行

git clone https://e.coding.net/robinqiwei/googleprotobuf.git protobuf

  vlog这个问题的原因,主要是想提醒自己以及和我有同样问题的人,当我们遇到问题时,一定要冷静下来,认真分析问题,不要手忙脚乱的,也不要赶快去换另一种方案,一定要把这套方案搞明白。遇到问题,我们可以去百度啊,Google啊,只需要ctrl-c这个问题然后ctrl-v这个问题到浏览器,就像是补补丁,我们衣服破了。只需要在破的地方补上补丁即可,没必要直接换衣服,在穷的时候这样办哈。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章