在终端调用以下命令来安装 API:go install google.golang.org/api/urlshortener/v1,报错:can’t load package: package google.golang.org/api/urlshortener/v1

1、在终端调用以下命令来安装 API:go install google.golang.org/api/urlshortener/v1,报错:can’t load package: package google.golang.org/api/urlshortener/v1。如图1

在终端调用以下命令来安装 API:go install google.golang.org/api/urlshortener/v1,报错:can't load package: package google.golang.org/api/urlshortener/v1。

图1

PS E:/wwwroot/go/src/uc> go install google.golang.org/api/urlshortener/v1
can't load package: package google.golang.org/api/urlshortener/v1: cannot find package "google.golang.org/api/urlshorten
er/v1" in any of:
        c:/go/src/google.golang.org/api/urlshortener/v1 (from $GOROOT)
        C:/Users/Administrator/go/src/google.golang.org/api/urlshortener/v1 (from $GOPATH)
        E:/wwwroot/go/src/google.golang.org/api/urlshortener/v1

2、参考:https://github.com/googleapis/google-api-go-client/blob/master/GettingStarted.md 。在终端调用以下命令来安装 API:go get -u google.golang.org/api/urlshortener/v1,报错:package google.golang.org/api/urlshortener/v1: unrecognized import path “google.golang.org/api/urlshortener/v1″。如图2

参考:https://github.com/googleapis/google-api-go-client/blob/master/GettingStarted.md 。在终端调用以下命令来安装 API:go get -u google.golang.org/api/urlshortener/v1,报错:package google.golang.org/api/urlshortener/v1: unrecognized import path "google.golang.org/api/urlshortener/v1"。

图2

PS E:/wwwroot/go/src/uc> go get -u google.golang.org/api/urlshortener/v1
package google.golang.org/api/urlshortener/v1: unrecognized import path "google.golang.org/api/urlshortener/v1" (https f
etch: Get https://google.golang.org/api/urlshortener/v1?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection att
empt failed because the connected party did not properly respond after a period of time, or established connection faile
d because connected host has failed to respond.)

3、参考:https://www.shuijingwanwq.com/2019/12/28/3784/ 。在终端调用以下命令来安装 API:go get -u google.golang.org/api/urlshortener/v1。如图3

参考:https://www.shuijingwanwq.com/2019/12/28/3784/ 。在终端调用以下命令来安装 API:go get -u google.golang.org/api/urlshortener/v1。

图3

C:/Users/Administrator>set HTTP_PROXY=http://127.0.0.1:50999

C:/Users/Administrator>set HTTPS_PROXY=http://127.0.0.1:50999

C:/Users/Administrator>ping golang.org

正在 Ping golang-consa.l.google.com [216.239.37.1] 具有 32 字节的数据:
请求超时。
请求超时。
请求超时。
请求超时。

216.239.37.1 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 0,丢失 = 4 (100% 丢失),

C:/Users/Administrator>curl -vv http://www.google.com
* Rebuilt URL to: http://www.google.com/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 50999 (#0)
> GET http://www.google.com/ HTTP/1.1
> Host: www.google.com
> User-Agent: curl/7.55.1
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 301 Moved Permanently
< Connection: close
< Cache-Control: max-age:86400
< Date: Thursday, 27-Aug-20 19:44:50 CST
< Expires: Fri, 28 Aug 2020 19:44:50 GMT
< Keep-Alive: timeout=58
< Location: https://www.google.com/
< Content-Length: 0
<
* Closing connection 0

C:/Users/Administrator> go get -u google.golang.org/api/urlshortener/v1
# cd .; git clone -- https://github.com/grpc/grpc-go C:/Users/Administrator/go/src/google.golang.org/grpc
Cloning into 'C:/Users/Administrator/go/src/google.golang.org/grpc'...
fatal: the remote end hung up unexpectedly
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
package google.golang.org/grpc: exit status 128
package google.golang.org/grpc/codes: cannot find package "google.golang.org/grpc/codes" in any of:
        c:/go/src/google.golang.org/grpc/codes (from $GOROOT)
        C:/Users/Administrator/go/src/google.golang.org/grpc/codes (from $GOPATH)
        E:/wwwroot/go/src/google.golang.org/grpc/codes
package google.golang.org/grpc/status: cannot find package "google.golang.org/grpc/status" in any of:
        c:/go/src/google.golang.org/grpc/status (from $GOROOT)
        C:/Users/Administrator/go/src/google.golang.org/grpc/status (from $GOPATH)
        E:/wwwroot/go/src/google.golang.org/grpc/status

C:/Users/Administrator> go get -u google.golang.org/api/urlshortener/v1

C:/Users/Administrator>

4、查看目录:C:/Users/Administrator/go/src/google.golang.org/api,目录:urlshortener 已经存在,安装 API 成功。如图4

查看目录:C:/Users/Administrator/go/src/google.golang.org/api,目录:urlshortener 已经存在,安装 API 成功。

图4

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/250553.html

(0)
上一篇 2022年4月29日
下一篇 2022年4月29日

相关推荐

发表回复

登录后才能评论