Bumping k8s dependencies to 1.13
This commit is contained in:
18
vendor/golang.org/x/tools/playground/appengine.go
generated
vendored
18
vendor/golang.org/x/tools/playground/appengine.go
generated
vendored
@@ -7,20 +7,28 @@
|
||||
package playground
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"appengine"
|
||||
"appengine/urlfetch"
|
||||
"google.golang.org/appengine"
|
||||
"google.golang.org/appengine/log"
|
||||
"google.golang.org/appengine/urlfetch"
|
||||
)
|
||||
|
||||
func init() {
|
||||
onAppengine = !appengine.IsDevAppServer()
|
||||
}
|
||||
|
||||
func client(r *http.Request) *http.Client {
|
||||
return urlfetch.Client(appengine.NewContext(r))
|
||||
func contextFunc(r *http.Request) context.Context {
|
||||
return appengine.NewContext(r)
|
||||
}
|
||||
|
||||
func post(ctx context.Context, url, contentType string, body io.Reader) (*http.Response, error) {
|
||||
return urlfetch.Client(ctx).Post(url, contentType, body)
|
||||
}
|
||||
|
||||
func report(r *http.Request, err error) {
|
||||
appengine.NewContext(r).Errorf("%v", err)
|
||||
ctx := appengine.NewContext(r)
|
||||
log.Errorf(ctx, "%v", err)
|
||||
}
|
||||
|
11
vendor/golang.org/x/tools/playground/appenginevm.go
generated
vendored
11
vendor/golang.org/x/tools/playground/appenginevm.go
generated
vendored
@@ -1,11 +0,0 @@
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build appenginevm
|
||||
|
||||
package playground
|
||||
|
||||
func init() {
|
||||
onAppengine = true
|
||||
}
|
12
vendor/golang.org/x/tools/playground/common.go
generated
vendored
12
vendor/golang.org/x/tools/playground/common.go
generated
vendored
@@ -9,13 +9,15 @@ package playground // import "golang.org/x/tools/playground"
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
const baseURL = "https://golang.org"
|
||||
const baseURL = "https://play.golang.org"
|
||||
|
||||
func init() {
|
||||
http.HandleFunc("/compile", bounce)
|
||||
@@ -25,7 +27,7 @@ func init() {
|
||||
func bounce(w http.ResponseWriter, r *http.Request) {
|
||||
b := new(bytes.Buffer)
|
||||
if err := passThru(b, r); err != nil {
|
||||
http.Error(w, "Server error.", http.StatusInternalServerError)
|
||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||
report(r, err)
|
||||
return
|
||||
}
|
||||
@@ -38,7 +40,9 @@ func passThru(w io.Writer, req *http.Request) error {
|
||||
}
|
||||
defer req.Body.Close()
|
||||
url := baseURL + req.URL.Path
|
||||
r, err := client(req).Post(url, req.Header.Get("Content-type"), req.Body)
|
||||
ctx, cancel := context.WithTimeout(contextFunc(req), 60*time.Second)
|
||||
defer cancel()
|
||||
r, err := post(ctx, url, req.Header.Get("Content-type"), req.Body)
|
||||
if err != nil {
|
||||
return fmt.Errorf("making POST request: %v", err)
|
||||
}
|
||||
@@ -49,7 +53,7 @@ func passThru(w io.Writer, req *http.Request) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var onAppengine = false // will be overriden by appengine.go and appenginevm.go
|
||||
var onAppengine = false // will be overridden by appengine.go
|
||||
|
||||
func allowShare(r *http.Request) bool {
|
||||
if !onAppengine {
|
||||
|
16
vendor/golang.org/x/tools/playground/local.go
generated
vendored
16
vendor/golang.org/x/tools/playground/local.go
generated
vendored
@@ -7,12 +7,24 @@
|
||||
package playground
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func client(r *http.Request) *http.Client {
|
||||
return http.DefaultClient
|
||||
func post(ctx context.Context, url, contentType string, body io.Reader) (*http.Response, error) {
|
||||
req, err := http.NewRequest("POST", url, body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("http.NewRequest: %v", err)
|
||||
}
|
||||
req.Header.Set("Content-Type", contentType)
|
||||
return http.DefaultClient.Do(req.WithContext(ctx))
|
||||
}
|
||||
|
||||
func contextFunc(_ *http.Request) context.Context {
|
||||
return context.Background()
|
||||
}
|
||||
|
||||
func report(r *http.Request, err error) {
|
||||
|
Reference in New Issue
Block a user