關於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這個問題到瀏覽器,就像是補補丁,我們衣服破了。只需要在破的地方補上補丁即可,沒必要直接換衣服,在窮的時候這樣辦哈。

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