Я создал с помощью команд govendor init
и govendor fetch "github.com/gorilla/mux"
каталог поставщика в проекте.
![enter image description here](https://i.stack.imgur.com/rVQbP.png)
Однако при выполнении развертывания в gcloudgcloud app deploy
возникает следующая ошибка, github.com/gorilla/mux
не найден:
ОШИБКА: (gcloud.app.deploy) Ответ об ошибке: [9] Развертывание содержит файлы, которые не могут быть скомпилированы: Ошибка компиляции:/work_dir/main.go:5:5: не удается найти импорт: "github.com/gorilla/mux"
Чего не хватает, чтобы заставить развертывание работать?Мой план свободен в gcloud
app.yaml
service: api
runtime: go
api_version: go1
handlers:
- url: /sample
script: _go_app
main.go
package main
import (
"encoding/json"
"github.com/gorilla/mux"
"net/http"
"google.golang.org/appengine"
)
type Foo struct {
Text string `json:"text"`
}
func GetInfo(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(Foo{"hello"})
}
func init(){
r := mux.NewRouter()
r.HandleFunc("/sample", GetInfo)
}
func main() {
appengine.Main()
}