gpt4 book ai didi

google-app-engine - `gcloud app deploy` 命令选择了错误的 GOPATH

转载 作者:数据小太阳 更新时间:2023-10-29 03:22:44 25 4
gpt4 key购买 nike

尝试使用 gcloud app deploy 通过 Cloud SQL 部署我的 GO 应用程序,但每次构建都失败并出现找不到包错误。不确定它从哪里选择 GOPATH。是否可以更改谷歌云引擎中的 GOPATH

  Step #0: main.go:9:2: cannot find package "github.com/gin-gonic/gin"
in any of: Step #0: /usr/local/go/src/github.com/gin-gonic/gin (from
$GOROOT) Step #0: /workspace/_gopath/src/github.com/gin-gonic/gin
(from $GOPATH) Step #0: main.go:10:2: cannot find package
"github.com/go-sql-driver/mysql" in any of: Step #0:
/usr/local/go/src/github.com/go-sql-driver/mysql (from $GOROOT) Step
#0: /workspace/_gopath/src/github.com/go-sql-driver/mysql (from $GOPATH) Step #0: main.go:8:2: cannot find package
"google.golang.org/appengine" in any of: Step #0:
/usr/local/go/src/google.golang.org/appengine (from $GOROOT) Step #0:
/workspace/_gopath/src/google.golang.org/appengine (from $GOPATH)

我有导入语句来包含上述库。我的本地 GOPATH 设置为 /Users/amar.jain/go/ 并且它正在尝试使用 /workplace/_gopath/

我也在使用 GO App Engine SDK。

最佳答案

如前所述in here ,在使用灵活环境时,应从 app.yaml 文件中删除以下行:

api_version: go1

Flexible 中比较 app.yaml 文件的示例和 Standard .

These是配置灵活环境时可用的选项。

关于google-app-engine - `gcloud app deploy` 命令选择了错误的 GOPATH,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50666443/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com