go 在安装echo框架的时候报https fetch failed: Get https://golang.org/x/crypto/acme/autocert?go-get=1: dial tcp

下面是安装的时候报错信息

package golang.org/x/crypto/acme imports golang.org/x/crypto/acme Fetching https://golang.org/x/crypto/acme/autocert?go-get=1 https fetch failed: Get https://golang.org/x/crypto/acme/autocert?go-get=1: dial tcp 216.239.37.1:443: i/o timeout package golang.org/x/crypto/acme/autocert: unrecognized import path "golang.org/x/crypto/acme/autocert" (https fetch: Get https://golang.org/x/crypto/acme/autocert?go-get=1: dial tcp 216.239.37.1:443: i/o timeout) Fetching https://golang.org/x/net/http2?go-get=1 https fetch failed: Get https://golang.org/x/net/http2?go-get=1: dial tcp 216.239.37.1:443: i/o timeout golang.org/x/net/http2 (download) package golang.org/x/net/http2: no Go files in /Users/user/hzl/webroot/gowork/src/golang.org/x/net/http2 Fetching https://golang.org/x/net/http2/h2c?go-get=1 https fetch failed: Get https://golang.org/x/net/http2/h2c?go-get=1: dial tcp 216.239.37.1:443: i/o timeout package golang.org/x/net/http2/h2c: unrecognized import path "golang.org/x/net/http2/h2c" (https fetch: Get https://golang.org/x/net/http2/h2c?go-get=1: dial tcp 216.239.37.1:443: i/o timeout) package io/ioutil: unrecognized import path "io/ioutil" (import path does not begin with hostname) package log: unrecognized import path "log" (import path does not begin with hostname) package mime/multipart: unrecognized import path "mime/multipart" (import path does not begin with hostname) package net: unrecognized import path "net" (import path does not begin with hostname)

这个就是咱们不能上墙导致下载不了组件所产生的问题,不过我在main.go里面还是写了echo.New()代码如下

package main

import (
"fmt"

//"golang.org/labstack/echo"
"github.com/labstack/echo"
)

func main() {
echo.New()
fmt.Println()
}

启动后肯定报错,产生好多错误,不过可以从错误结果中找到问题,一个一个慢慢解决。

 

import cycle not allowed
    package main
    imports github.com/labstack/echo
    imports golang.org/x/crypto/acme
    imports golang.org/x/crypto/acme
    src/github.com/labstack/echo/echo.go:61:2: cannot find package "golang.org/x/crypto/acme/autocert" in any of:
    /usr/local/opt/[email protected]/libexec/src/golang.org/x/crypto/acme/autocert (from $GOROOT)
    /Users/user/hzl/webroot/gowork/src/golang.org/x/crypto/acme/autocert (from $GOPATH)
    src/github.com/labstack/echo/echo.go:62:2: no Go files in /usr/local/opt/[email protected]/libexec/src/golang.org/x/net/http2
    src/github.com/labstack/echo/echo.go:63:2: cannot find package "golang.org/x/net/http2/h2c" in any of:
    /usr/local/opt/[email protected]/libexec/src/golang.org/x/net/http2/h2c (from $GOROOT)
    /Users/user/hzl/webroot/gowork/src/golang.org/x/net/http2/h2c (from $GOPATH)
大家可以去https://github.com/golang/xxx下载到所缺的文件在跟目录创建golang.org文件夹然后根据 https://golang.org/x/crypto/acme/autocert安装时的错误路径放文件,再启动就OK啦。成功了
   ____    __
  / __/___/ /  ___
 / _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.1.16
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
                                    O\
⇨ http server started on [::]:1323

你可能感兴趣的:(go 在安装echo框架的时候报https fetch failed: Get https://golang.org/x/crypto/acme/autocert?go-get=1: dial tcp)