尝试使用 Golang 和 Echo 构建一个简单的 crud api,但我无法通过 Echo 文档中的第一个步骤。
我跑go get -u github.com/labstack/echo/...
然后我创建 server.go:
package main
import (
"net/http"
"github.com/labstack/echo/v4"
)
func main() {
e := echo.New()
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
e.Logger.Fatal(e.Start(":1323"))
}
但是当我尝试运行时:go run server.go
我收到此错误:
server.go:6:2: cannot find package "github.com/labstack/echo/v4" in any of:
/usr/local/Cellar/go/1.14.4/libexec/src/github.com/labstack/echo/v4 (from $GOROOT)
/Users/dariusgoore/go/src/github.com/labstack/echo/v4 (from $GOPATH)