Bumping k8s dependencies to 1.13
This commit is contained in:
3
vendor/github.com/mailru/easyjson/bootstrap/bootstrap.go
generated
vendored
3
vendor/github.com/mailru/easyjson/bootstrap/bootstrap.go
generated
vendored
@@ -169,9 +169,10 @@ func (g *Generator) Run() error {
|
||||
defer os.Remove(f.Name()) // will not remove after rename
|
||||
}
|
||||
|
||||
cmd := exec.Command("go", "run", "-tags", g.BuildTags, path)
|
||||
cmd := exec.Command("go", "run", "-tags", g.BuildTags, filepath.Base(path))
|
||||
cmd.Stdout = f
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Dir = filepath.Dir(path)
|
||||
if err = cmd.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
17
vendor/github.com/mailru/easyjson/jlexer/lexer.go
generated
vendored
17
vendor/github.com/mailru/easyjson/jlexer/lexer.go
generated
vendored
@@ -240,7 +240,7 @@ func (r *Lexer) fetchNumber() {
|
||||
|
||||
// findStringLen tries to scan into the string literal for ending quote char to determine required size.
|
||||
// The size will be exact if no escapes are present and may be inexact if there are escaped chars.
|
||||
func findStringLen(data []byte) (hasEscapes bool, length int) {
|
||||
func findStringLen(data []byte) (isValid, hasEscapes bool, length int) {
|
||||
delta := 0
|
||||
|
||||
for i := 0; i < len(data); i++ {
|
||||
@@ -252,11 +252,11 @@ func findStringLen(data []byte) (hasEscapes bool, length int) {
|
||||
delta++
|
||||
}
|
||||
case '"':
|
||||
return (delta > 0), (i - delta)
|
||||
return true, (delta > 0), (i - delta)
|
||||
}
|
||||
}
|
||||
|
||||
return false, len(data)
|
||||
return false, false, len(data)
|
||||
}
|
||||
|
||||
// getu4 decodes \uXXXX from the beginning of s, returning the hex value,
|
||||
@@ -342,7 +342,12 @@ func (r *Lexer) fetchString() {
|
||||
r.pos++
|
||||
data := r.Data[r.pos:]
|
||||
|
||||
hasEscapes, length := findStringLen(data)
|
||||
isValid, hasEscapes, length := findStringLen(data)
|
||||
if !isValid {
|
||||
r.pos += length
|
||||
r.errParse("unterminated string literal")
|
||||
return
|
||||
}
|
||||
if !hasEscapes {
|
||||
r.token.byteValue = data[:length]
|
||||
r.pos += length + 1
|
||||
@@ -649,7 +654,7 @@ func (r *Lexer) Bytes() []byte {
|
||||
return nil
|
||||
}
|
||||
ret := make([]byte, base64.StdEncoding.DecodedLen(len(r.token.byteValue)))
|
||||
len, err := base64.StdEncoding.Decode(ret, r.token.byteValue)
|
||||
n, err := base64.StdEncoding.Decode(ret, r.token.byteValue)
|
||||
if err != nil {
|
||||
r.fatalError = &LexerError{
|
||||
Reason: err.Error(),
|
||||
@@ -658,7 +663,7 @@ func (r *Lexer) Bytes() []byte {
|
||||
}
|
||||
|
||||
r.consume()
|
||||
return ret[:len]
|
||||
return ret[:n]
|
||||
}
|
||||
|
||||
// Bool reads a true or false boolean keyword.
|
||||
|
19
vendor/github.com/mailru/easyjson/jlexer/lexer_test.go
generated
vendored
19
vendor/github.com/mailru/easyjson/jlexer/lexer_test.go
generated
vendored
@@ -312,3 +312,22 @@ func TestJsonNumber(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestFetchStringUnterminatedString(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
data []byte
|
||||
}{
|
||||
{data: []byte(`"sting without trailing quote`)},
|
||||
{data: []byte(`"\"`)},
|
||||
{data: []byte{'"'}},
|
||||
} {
|
||||
l := Lexer{Data: test.data}
|
||||
l.fetchString()
|
||||
if l.pos > len(l.Data) {
|
||||
t.Errorf("fetchString(%s): pos should not be greater than length of Data", test.data)
|
||||
}
|
||||
if l.Error() == nil {
|
||||
t.Errorf("fetchString(%s): should add parsing error", test.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
3
vendor/github.com/mailru/easyjson/parser/parser.go
generated
vendored
3
vendor/github.com/mailru/easyjson/parser/parser.go
generated
vendored
@@ -1,6 +1,7 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"go/ast"
|
||||
"go/parser"
|
||||
"go/token"
|
||||
@@ -93,5 +94,5 @@ func (p *Parser) Parse(fname string, isDir bool) error {
|
||||
|
||||
func getDefaultGoPath() (string, error) {
|
||||
output, err := exec.Command("go", "env", "GOPATH").Output()
|
||||
return string(output), err
|
||||
return string(bytes.TrimSpace(output)), err
|
||||
}
|
||||
|
42
vendor/github.com/mailru/easyjson/parser/parser_unix.go
generated
vendored
42
vendor/github.com/mailru/easyjson/parser/parser_unix.go
generated
vendored
@@ -1,42 +0,0 @@
|
||||
// +build !windows
|
||||
|
||||
package parser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func getPkgPath(fname string, isDir bool) (string, error) {
|
||||
if !path.IsAbs(fname) {
|
||||
pwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
fname = path.Join(pwd, fname)
|
||||
}
|
||||
|
||||
gopath := os.Getenv("GOPATH")
|
||||
if gopath == "" {
|
||||
var err error
|
||||
gopath, err = getDefaultGoPath()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("cannot determine GOPATH: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
for _, p := range strings.Split(os.Getenv("GOPATH"), ":") {
|
||||
prefix := path.Join(p, "src") + "/"
|
||||
if rel := strings.TrimPrefix(fname, prefix); rel != fname {
|
||||
if !isDir {
|
||||
return path.Dir(rel), nil
|
||||
} else {
|
||||
return path.Clean(rel), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("file '%v' is not in GOPATH", fname)
|
||||
}
|
49
vendor/github.com/mailru/easyjson/parser/parser_windows.go
generated
vendored
49
vendor/github.com/mailru/easyjson/parser/parser_windows.go
generated
vendored
@@ -1,49 +0,0 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func normalizePath(path string) string {
|
||||
// use lower case, as Windows file systems will almost always be case insensitive
|
||||
return strings.ToLower(strings.Replace(path, "\\", "/", -1))
|
||||
}
|
||||
|
||||
func getPkgPath(fname string, isDir bool) (string, error) {
|
||||
// path.IsAbs doesn't work properly on Windows; use filepath.IsAbs instead
|
||||
if !filepath.IsAbs(fname) {
|
||||
pwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
fname = path.Join(pwd, fname)
|
||||
}
|
||||
|
||||
fname = normalizePath(fname)
|
||||
|
||||
gopath := os.Getenv("GOPATH")
|
||||
if gopath == "" {
|
||||
var err error
|
||||
gopath, err = getDefaultGoPath()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("cannot determine GOPATH: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
for _, p := range strings.Split(os.Getenv("GOPATH"), ";") {
|
||||
prefix := path.Join(normalizePath(p), "src") + "/"
|
||||
if rel := strings.TrimPrefix(fname, prefix); rel != fname {
|
||||
if !isDir {
|
||||
return path.Dir(rel), nil
|
||||
} else {
|
||||
return path.Clean(rel), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("file '%v' is not in GOPATH", fname)
|
||||
}
|
163
vendor/github.com/mailru/easyjson/parser/pkgpath.go
generated
vendored
Normal file
163
vendor/github.com/mailru/easyjson/parser/pkgpath.go
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func getPkgPath(fname string, isDir bool) (string, error) {
|
||||
if !filepath.IsAbs(fname) {
|
||||
pwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
fname = filepath.Join(pwd, fname)
|
||||
}
|
||||
|
||||
goModPath, _ := goModPath(fname, isDir)
|
||||
if strings.Contains(goModPath, "go.mod") {
|
||||
pkgPath, err := getPkgPathFromGoMod(fname, isDir, goModPath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return pkgPath, nil
|
||||
}
|
||||
|
||||
return getPkgPathFromGOPATH(fname, isDir)
|
||||
}
|
||||
|
||||
var (
|
||||
goModPathCache = make(map[string]string)
|
||||
)
|
||||
|
||||
// empty if no go.mod, GO111MODULE=off or go without go modules support
|
||||
func goModPath(fname string, isDir bool) (string, error) {
|
||||
root := fname
|
||||
if !isDir {
|
||||
root = filepath.Dir(fname)
|
||||
}
|
||||
|
||||
goModPath, ok := goModPathCache[root]
|
||||
if ok {
|
||||
return goModPath, nil
|
||||
}
|
||||
|
||||
defer func() {
|
||||
goModPathCache[root] = goModPath
|
||||
}()
|
||||
|
||||
cmd := exec.Command("go", "env", "GOMOD")
|
||||
cmd.Dir = root
|
||||
|
||||
stdout, err := cmd.Output()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
goModPath = string(bytes.TrimSpace(stdout))
|
||||
|
||||
return goModPath, nil
|
||||
}
|
||||
|
||||
func getPkgPathFromGoMod(fname string, isDir bool, goModPath string) (string, error) {
|
||||
modulePath := getModulePath(goModPath)
|
||||
if modulePath == "" {
|
||||
return "", fmt.Errorf("cannot determine module path from %s", goModPath)
|
||||
}
|
||||
|
||||
rel := path.Join(modulePath, filePathToPackagePath(strings.TrimPrefix(fname, filepath.Dir(goModPath))))
|
||||
|
||||
if !isDir {
|
||||
return path.Dir(rel), nil
|
||||
}
|
||||
|
||||
return path.Clean(rel), nil
|
||||
}
|
||||
|
||||
var (
|
||||
modulePrefix = []byte("\nmodule ")
|
||||
pkgPathFromGoModCache = make(map[string]string)
|
||||
)
|
||||
|
||||
func getModulePath(goModPath string) string {
|
||||
pkgPath, ok := pkgPathFromGoModCache[goModPath]
|
||||
if ok {
|
||||
return pkgPath
|
||||
}
|
||||
|
||||
defer func() {
|
||||
pkgPathFromGoModCache[goModPath] = pkgPath
|
||||
}()
|
||||
|
||||
data, err := ioutil.ReadFile(goModPath)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
var i int
|
||||
if bytes.HasPrefix(data, modulePrefix[1:]) {
|
||||
i = 0
|
||||
} else {
|
||||
i = bytes.Index(data, modulePrefix)
|
||||
if i < 0 {
|
||||
return ""
|
||||
}
|
||||
i++
|
||||
}
|
||||
line := data[i:]
|
||||
|
||||
// Cut line at \n, drop trailing \r if present.
|
||||
if j := bytes.IndexByte(line, '\n'); j >= 0 {
|
||||
line = line[:j]
|
||||
}
|
||||
if line[len(line)-1] == '\r' {
|
||||
line = line[:len(line)-1]
|
||||
}
|
||||
line = line[len("module "):]
|
||||
|
||||
// If quoted, unquote.
|
||||
pkgPath = strings.TrimSpace(string(line))
|
||||
if pkgPath != "" && pkgPath[0] == '"' {
|
||||
s, err := strconv.Unquote(pkgPath)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
pkgPath = s
|
||||
}
|
||||
return pkgPath
|
||||
}
|
||||
|
||||
func getPkgPathFromGOPATH(fname string, isDir bool) (string, error) {
|
||||
gopath := os.Getenv("GOPATH")
|
||||
if gopath == "" {
|
||||
var err error
|
||||
gopath, err = getDefaultGoPath()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("cannot determine GOPATH: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
for _, p := range strings.Split(gopath, string(filepath.ListSeparator)) {
|
||||
prefix := filepath.Join(p, "src") + string(filepath.Separator)
|
||||
if rel := strings.TrimPrefix(fname, prefix); rel != fname {
|
||||
if !isDir {
|
||||
return path.Dir(filePathToPackagePath(rel)), nil
|
||||
} else {
|
||||
return path.Clean(filePathToPackagePath(rel)), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("file '%v' is not in GOPATH", fname)
|
||||
}
|
||||
|
||||
func filePathToPackagePath(path string) string {
|
||||
return filepath.ToSlash(path)
|
||||
}
|
Reference in New Issue
Block a user