When I deploy my Go application to GAE, the /_ah/start
endpoint is never invoked. When I run the following code, the log does not contain the "STARTING" entry and /
does not have the X
set.
What am I missing?
server.go:
package main
import (
"net/http"
"google.golang.org/appengine"
"google.golang.org/appengine/log"
)
var X string
func init() {
http.HandleFunc("/_ah/start", start)
http.HandleFunc("/", meh)
}
func start(w http.ResponseWriter, r *http.Request) {
X = "!!!!!"
c := appengine.NewContext(r)
log.Infof(c, "STARTING")
}
func meh(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("The value is: " + X))
}
app.yaml:
application: my-app
version: 1
runtime: go
api_version: go1
handlers:
- url: /.*
secure: always
script: _go_app