gpt4 book ai didi

google-app-engine - 您的应用程序不在 GOPATH 上 - 部署到 app Engine go1.12

转载 作者:行者123 更新时间:2023-12-02 04:26:34 25 4
gpt4 key购买 nike

我在使用 appengine 和 go112 时遇到问题。

我无法在没有错误的情况下部署到云:

2019/09/04 14:36:10 Copying /workspace/_gopath/src/mysql to /tmp/staging/srv/gopath/src/mysql
2019/09/04 14:36:10 Your app is not on your GOPATH, this build may fail.
2019/09/04 14:36:10 Building from Go source in /tmp/staging/srv, with main package at ./...
2019/09/04 14:36:10 Building /tmp/staging/srv, saving to /tmp/staging/usr/local/bin/start
2019/09/04 14:36:11 Wrote build output to /builder/outputs/output
2019/09/04 14:36:11 Failed to build app: Your app is not on your GOPATH, please move it there and try again.
building app with command '[go build -o /tmp/staging/usr/local/bin/start ./...]', env '[PATH=/go/bin:/usr/local/go/bin:/builder/google-cloud-sdk/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOSTNAME=89fd1b631b04 HOME=/builder/home BUILDER_OUTPUT=/builder/outputs DEBIAN_FRONTEND=noninteractive GOROOT=/usr/local/go/ GOPATH=/go GOPATH=/tmp/staging/srv/gopath]': err=exit status 1, out=go build: cannot use -o with multiple packages.
PS C:\gopath\projects\gp-sql>

我的项目位于 gopath 下,我尝试了对其进行了一些修改。

image

“go env”的输出

set GOPATH=C:\gopath
set GOROOT=C:\golang

有人知道我错过了什么吗?

最佳答案

您的项目文件夹应位于“\src”中,而不是“\projects”中。

对于standard Go setups ,无论您的基本 GOPATH 环境变量指向什么,该文件夹内的结构应该如下:

bin/
# command executables

src/
github.com/golang/example/
.git/ # Git repository metadata
hello/
hello.go # command source
myproject1/
main.go # command source
main_test.go # test source
app.yaml # google cloud configuration
myproject2/
beepboop.go # command source
stringutil/
reverse.go # package source
reverse_test.go # test source
golang.org/x/image/
.git/ # Git repository metadata
bmp/
reader.go # package source
writer.go # package source
... (many more repositories and packages omitted) ...

关于google-app-engine - 您的应用程序不在 GOPATH 上 - 部署到 app Engine go1.12,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57790884/

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