mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Switch from govendor to go modules. (#587)
Thanks to @BenoitKnecht for leading the way on this.
This commit is contained in:
21
vendor/google.golang.org/appengine/internal/main_vm.go
generated
vendored
21
vendor/google.golang.org/appengine/internal/main_vm.go
generated
vendored
@ -12,9 +12,12 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func Main() {
|
||||
MainPath = filepath.Dir(findMainPath())
|
||||
installHealthChecker(http.DefaultServeMux)
|
||||
|
||||
port := "8080"
|
||||
@ -31,6 +34,24 @@ func Main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Find the path to package main by looking at the root Caller.
|
||||
func findMainPath() string {
|
||||
pc := make([]uintptr, 100)
|
||||
n := runtime.Callers(2, pc)
|
||||
frames := runtime.CallersFrames(pc[:n])
|
||||
for {
|
||||
frame, more := frames.Next()
|
||||
// Tests won't have package main, instead they have testing.tRunner
|
||||
if frame.Function == "main.main" || frame.Function == "testing.tRunner" {
|
||||
return frame.File
|
||||
}
|
||||
if !more {
|
||||
break
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func installHealthChecker(mux *http.ServeMux) {
|
||||
// If no health check handler has been installed by this point, add a trivial one.
|
||||
const healthPath = "/_ah/health"
|
||||
|
Reference in New Issue
Block a user