Update go dependencies and cleanup deprecated packages

This commit is contained in:
Manuel de Brito Fontes 2018-01-07 12:10:25 -03:00
parent 03a1e20fde
commit 44fd79d061
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
1099 changed files with 75691 additions and 31913 deletions

View file

@ -12,6 +12,7 @@ go_test(
"jsonpath_test.go",
"parser_test.go",
],
importpath = "k8s.io/client-go/util/jsonpath",
library = ":go_default_library",
)
@ -23,6 +24,7 @@ go_library(
"node.go",
"parser.go",
],
importpath = "k8s.io/client-go/util/jsonpath",
deps = ["//vendor/k8s.io/client-go/third_party/forked/golang/template:go_default_library"],
)

View file

@ -43,7 +43,11 @@ type Parser struct {
width int
}
var ErrSyntax = errors.New("invalid syntax")
var (
ErrSyntax = errors.New("invalid syntax")
dictKeyRex = regexp.MustCompile(`^'([^']*)'$`)
sliceOperatorRex = regexp.MustCompile(`^(-?[\d]*)(:-?[\d]*)?(:[\d]*)?$`)
)
// Parse parsed the given text and return a node Parser.
// If an error is encountered, parsing stops and an empty
@ -283,8 +287,7 @@ Loop:
}
// dict key
reg := regexp.MustCompile(`^'([^']*)'$`)
value := reg.FindStringSubmatch(text)
value := dictKeyRex.FindStringSubmatch(text)
if value != nil {
parser, err := parseAction("arraydict", fmt.Sprintf(".%s", value[1]))
if err != nil {
@ -297,8 +300,7 @@ Loop:
}
//slice operator
reg = regexp.MustCompile(`^(-?[\d]*)(:-?[\d]*)?(:[\d]*)?$`)
value = reg.FindStringSubmatch(text)
value = sliceOperatorRex.FindStringSubmatch(text)
if value == nil {
return fmt.Errorf("invalid array index %s", text)
}