我正在嘗試將用 Go 編寫的舊 Google App Engine(標準環境)項目遷移到運行時 1.12。自 2017 年底以來我就沒有碰過它,從那以后似乎發生了很多變化。我已經能夠解決一些問題,但由于我有一些外部依賴項,所以我無法部署代碼。嘗試部署時控制臺輸出的相關部分d:\src\go\src\data-axe>go env GOPATHd:\src\god:\src\go\src\data-axe>gcloud app deploy --no-promote...Error type: BuildError.Error message: 2019/09/27 19:10:09 Your app is not on your GOPATH, this build may fail.2019/09/27 19:10:10 Building from Go source in /tmp/staging/srv, with main package at ./...2019/09/27 19:10:10 Building /tmp/staging/srv, saving to /tmp/staging/usr/local/bin/start2019/09/27 19:10:11 Wrote build output to /builder/outputs/output2019/09/27 19:10:11 Failed to build app: Your app is not on your GOPATH, please move it there and try again.... err=exit status 1, out=srv/main.go:6:2: cannot find package "github.com/microcosm-cc/bluemonday" in any of:...正如上面的代碼片段所示,我的 GOPATH 設置為d:\src\go,我的應用程序位于d:\src\go\src\data-axe,并且我正在使用的 Bluemonday 位于 ,d:\src\go\src\github.com\microcosm-cc\bluemonday所以據我所知,所有這些都在我的 GOPATH 中。用于指定依賴項的App Engine 文檔說如果您的應用程序位于 GOPATH 上的目錄中,App Engine 會分析、復制并上傳來自 GOPATH 的導入。此方法支持供應商目錄。這里一定有什么我不明白的地方。我的代碼和我在 GOPATH 中使用的庫都有,但當我嘗試部署時,App Engine 似乎沒有拾取并上傳我的導入。我的 main.go 中的導入使用絕對路徑,正如文檔所述:package mainimport ( "fmt" "net/http" "github.com/microcosm-cc/bluemonday" "strings" "log" "os")我究竟做錯了什么?
無法部署使用外部庫的運行時 1.12 的 AppEngine Go 應用程序
慕蓋茨4494581
2023-07-26 17:15:02